The session will use the feature repository from the {@link MultiProtocolFeatureRepository} + * selected using {@link MultiProtocolFeatureRepository#selectProtocolVersion(ProtocolVersion)} + * when the negotiated {@link ProtocolVersion} is known (after the WebSocket handshake). + * + * @param communicator the {@link Communicator} to use for the client session + * @return the client {@link Session} + */ + @Override + public ISession createSession(Communicator communicator) { + AsyncPromiseFulfillerDecorator promiseFulfiller = + new AsyncPromiseFulfillerDecorator(new SimplePromiseFulfiller()); + return new Session(communicator, new Queue(), promiseFulfiller, multiProtocolFeatureRepository); + } + + /** + * Creates a server session + * + *
The session will use the feature repository for the given {@link ProtocolVersion}.
+ *
+ * @param communicator the {@link Communicator} to use for the server session
+ * @param protocolVersion the {@link ProtocolVersion} to use for the server session
+ * @return the server {@link Session}
+ */
+ public ISession createSession(Communicator communicator, ProtocolVersion protocolVersion) {
+ IFeatureRepository featureRepository =
+ multiProtocolFeatureRepository.getFeatureRepository(protocolVersion);
+ AsyncPromiseFulfillerDecorator promiseFulfiller =
+ new AsyncPromiseFulfillerDecorator(new SimplePromiseFulfiller());
+ return new Session(communicator, new Queue(), promiseFulfiller, featureRepository);
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/MultiProtocolWebSocketListener.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/MultiProtocolWebSocketListener.java
new file mode 100644
index 000000000..47c37fe45
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/MultiProtocolWebSocketListener.java
@@ -0,0 +1,319 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Copyright (C) 2016-2018 Thomas Volden OCPP 2.0.1 FINAL
+ */
+public final class AuthorizeRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * A case insensitive identifier to use for the authorization and the type of authorization to
+ * support multiple forms of identifiers.
+ */
+ private IdToken idToken;
+
+ /** The X.509 certificated presented by EV and encoded in PEM format. */
+ @Nullable private String certificate;
+
+ /** iso15118CertificateHashData */
+ @Nullable private OCSPRequestData[] iso15118CertificateHashData;
+
+ /**
+ * Constructor for the AuthorizeRequest class
+ *
+ * @param idToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers.
+ */
+ public AuthorizeRequest(IdToken idToken) {
+ setIdToken(idToken);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public AuthorizeRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @return A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public IdToken getIdToken() {
+ return idToken;
+ }
+
+ /**
+ * Sets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param idToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public void setIdToken(IdToken idToken) {
+ if (!isValidIdToken(idToken)) {
+ throw new PropertyConstraintException(idToken, "idToken is invalid");
+ }
+ this.idToken = idToken;
+ }
+
+ /**
+ * Returns whether the given idToken is valid
+ *
+ * @param idToken the idToken to check the validity of
+ * @return {@code true} if idToken is valid, {@code false} if not
+ */
+ private boolean isValidIdToken(IdToken idToken) {
+ return idToken != null && idToken.validate();
+ }
+
+ /**
+ * Gets the X.509 certificated presented by EV and encoded in PEM format.
+ *
+ * @return The X.509 certificated presented by EV and encoded in PEM format
+ */
+ @Nullable
+ public String getCertificate() {
+ return certificate;
+ }
+
+ /**
+ * Sets the X.509 certificated presented by EV and encoded in PEM format.
+ *
+ * @param certificate The X.509 certificated presented by EV and encoded in PEM format
+ */
+ public void setCertificate(@Nullable String certificate) {
+ if (!isValidCertificate(certificate)) {
+ throw new PropertyConstraintException(certificate, "certificate is invalid");
+ }
+ this.certificate = certificate;
+ }
+
+ /**
+ * Returns whether the given certificate is valid
+ *
+ * @param certificate the certificate to check the validity of
+ * @return {@code true} if certificate is valid, {@code false} if not
+ */
+ private boolean isValidCertificate(@Nullable String certificate) {
+ return certificate == null || certificate.length() <= 5500;
+ }
+
+ /**
+ * Adds the X.509 certificated presented by EV and encoded in PEM format.
+ *
+ * @param certificate The X.509 certificated presented by EV and encoded in PEM format
+ * @return this
+ */
+ public AuthorizeRequest withCertificate(@Nullable String certificate) {
+ setCertificate(certificate);
+ return this;
+ }
+
+ /**
+ * Gets iso15118CertificateHashData
+ *
+ * @return iso15118CertificateHashData
+ */
+ @Nullable
+ public OCSPRequestData[] getIso15118CertificateHashData() {
+ return iso15118CertificateHashData;
+ }
+
+ /**
+ * Sets iso15118CertificateHashData
+ *
+ * @param iso15118CertificateHashData iso15118CertificateHashData
+ */
+ public void setIso15118CertificateHashData(
+ @Nullable OCSPRequestData[] iso15118CertificateHashData) {
+ if (!isValidIso15118CertificateHashData(iso15118CertificateHashData)) {
+ throw new PropertyConstraintException(
+ iso15118CertificateHashData, "iso15118CertificateHashData is invalid");
+ }
+ this.iso15118CertificateHashData = iso15118CertificateHashData;
+ }
+
+ /**
+ * Returns whether the given iso15118CertificateHashData is valid
+ *
+ * @param iso15118CertificateHashData the iso15118CertificateHashData to check the validity of
+ * @return {@code true} if iso15118CertificateHashData is valid, {@code false} if not
+ */
+ private boolean isValidIso15118CertificateHashData(
+ @Nullable OCSPRequestData[] iso15118CertificateHashData) {
+ return iso15118CertificateHashData == null
+ || (iso15118CertificateHashData.length >= 1
+ && iso15118CertificateHashData.length <= 4
+ && Arrays.stream(iso15118CertificateHashData).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds iso15118CertificateHashData
+ *
+ * @param iso15118CertificateHashData iso15118CertificateHashData
+ * @return this
+ */
+ public AuthorizeRequest withIso15118CertificateHashData(
+ @Nullable OCSPRequestData[] iso15118CertificateHashData) {
+ setIso15118CertificateHashData(iso15118CertificateHashData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidIdToken(idToken)
+ && isValidCertificate(certificate)
+ && isValidIso15118CertificateHashData(iso15118CertificateHashData);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ AuthorizeRequest that = (AuthorizeRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(idToken, that.idToken)
+ && Objects.equals(certificate, that.certificate)
+ && Arrays.equals(iso15118CertificateHashData, that.iso15118CertificateHashData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, idToken, certificate, Arrays.hashCode(iso15118CertificateHashData));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("idToken", idToken)
+ .add("certificate", certificate)
+ .add("iso15118CertificateHashData", iso15118CertificateHashData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/AuthorizeResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/AuthorizeResponse.java
new file mode 100644
index 000000000..4dc50af57
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/AuthorizeResponse.java
@@ -0,0 +1,217 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.AuthorizeCertificateStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.IdTokenInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * AuthorizeResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class AuthorizeResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * ID Token
+ *
+ * Status information about an identifier. It is advised to not stop charging for a token that
+ * expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is not
+ * given, the status has no end date.
+ */
+ private IdTokenInfo idTokenInfo;
+
+ /**
+ * Certificate status information.
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class BootNotificationRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Charge Point
+ *
+ * The physical system where an Electrical Vehicle (EV) can be charged.
+ */
+ private ChargingStation chargingStation;
+
+ /** The reason for sending this message to the CSMS. */
+ private BootReasonEnum reason;
+
+ /**
+ * Constructor for the BootNotificationRequest class
+ *
+ * @param chargingStation The physical system where an Electrical Vehicle (EV) can be charged.
+ * @param reason The reason for sending this message to the CSMS.
+ */
+ public BootNotificationRequest(ChargingStation chargingStation, BootReasonEnum reason) {
+ setChargingStation(chargingStation);
+ setReason(reason);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public BootNotificationRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the physical system where an Electrical Vehicle (EV) can be charged.
+ *
+ * @return The physical system where an Electrical Vehicle (EV) can be charged
+ */
+ public ChargingStation getChargingStation() {
+ return chargingStation;
+ }
+
+ /**
+ * Sets the physical system where an Electrical Vehicle (EV) can be charged.
+ *
+ * @param chargingStation The physical system where an Electrical Vehicle (EV) can be charged
+ */
+ public void setChargingStation(ChargingStation chargingStation) {
+ if (!isValidChargingStation(chargingStation)) {
+ throw new PropertyConstraintException(chargingStation, "chargingStation is invalid");
+ }
+ this.chargingStation = chargingStation;
+ }
+
+ /**
+ * Returns whether the given chargingStation is valid
+ *
+ * @param chargingStation the chargingStation to check the validity of
+ * @return {@code true} if chargingStation is valid, {@code false} if not
+ */
+ private boolean isValidChargingStation(ChargingStation chargingStation) {
+ return chargingStation != null && chargingStation.validate();
+ }
+
+ /**
+ * Gets the reason for sending this message to the CSMS.
+ *
+ * @return The reason for sending this message to the CSMS
+ */
+ public BootReasonEnum getReason() {
+ return reason;
+ }
+
+ /**
+ * Sets the reason for sending this message to the CSMS.
+ *
+ * @param reason The reason for sending this message to the CSMS
+ */
+ public void setReason(BootReasonEnum reason) {
+ if (!isValidReason(reason)) {
+ throw new PropertyConstraintException(reason, "reason is invalid");
+ }
+ this.reason = reason;
+ }
+
+ /**
+ * Returns whether the given reason is valid
+ *
+ * @param reason the reason to check the validity of
+ * @return {@code true} if reason is valid, {@code false} if not
+ */
+ private boolean isValidReason(BootReasonEnum reason) {
+ return reason != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidChargingStation(chargingStation)
+ && isValidReason(reason);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ BootNotificationRequest that = (BootNotificationRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(chargingStation, that.chargingStation)
+ && Objects.equals(reason, that.reason);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, chargingStation, reason);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("chargingStation", chargingStation)
+ .add("reason", reason)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/BootNotificationResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/BootNotificationResponse.java
new file mode 100644
index 000000000..e0b4ce702
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/BootNotificationResponse.java
@@ -0,0 +1,302 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.RegistrationStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * BootNotificationResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class BootNotificationResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The CSMSâs current time. */
+ private ZonedDateTime currentTime;
+
+ /**
+ * When Status is Accepted, this contains the heartbeat interval in seconds. If the CSMS returns
+ * something other than Accepted, the value of the interval field indicates the minimum wait time
+ * before sending a next BootNotification request.
+ */
+ private Integer interval;
+
+ /** Whether the Charging Station has been registered within the CSMS. */
+ private RegistrationStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the BootNotificationResponse class
+ *
+ * @param currentTime The CSMSâs current time.
+ * @param interval When Status is Accepted, this contains the heartbeat interval in seconds. If
+ * the CSMS returns something other than Accepted, the value of the interval field indicates
+ * the minimum wait time before sending a next BootNotification request.
+ * @param status Whether the Charging Station has been registered within the CSMS.
+ */
+ public BootNotificationResponse(
+ ZonedDateTime currentTime, Integer interval, RegistrationStatusEnum status) {
+ setCurrentTime(currentTime);
+ setInterval(interval);
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public BootNotificationResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the CSMSâs current time.
+ *
+ * @return The CSMSâs current time
+ */
+ public ZonedDateTime getCurrentTime() {
+ return currentTime;
+ }
+
+ /**
+ * Sets the CSMSâs current time.
+ *
+ * @param currentTime The CSMSâs current time
+ */
+ public void setCurrentTime(ZonedDateTime currentTime) {
+ if (!isValidCurrentTime(currentTime)) {
+ throw new PropertyConstraintException(currentTime, "currentTime is invalid");
+ }
+ this.currentTime = currentTime;
+ }
+
+ /**
+ * Returns whether the given currentTime is valid
+ *
+ * @param currentTime the currentTime to check the validity of
+ * @return {@code true} if currentTime is valid, {@code false} if not
+ */
+ private boolean isValidCurrentTime(ZonedDateTime currentTime) {
+ return currentTime != null;
+ }
+
+ /**
+ * Gets when Status is Accepted, this contains the heartbeat interval in seconds. If the CSMS
+ * returns something other than Accepted, the value of the interval field indicates the minimum
+ * wait time before sending a next BootNotification request.
+ *
+ * @return When Status is Accepted, this contains the heartbeat interval in seconds
+ */
+ public Integer getInterval() {
+ return interval;
+ }
+
+ /**
+ * Sets when Status is Accepted, this contains the heartbeat interval in seconds. If the CSMS
+ * returns something other than Accepted, the value of the interval field indicates the minimum
+ * wait time before sending a next BootNotification request.
+ *
+ * @param interval When Status is Accepted, this contains the heartbeat interval in seconds
+ */
+ public void setInterval(Integer interval) {
+ if (!isValidInterval(interval)) {
+ throw new PropertyConstraintException(interval, "interval is invalid");
+ }
+ this.interval = interval;
+ }
+
+ /**
+ * Returns whether the given interval is valid
+ *
+ * @param interval the interval to check the validity of
+ * @return {@code true} if interval is valid, {@code false} if not
+ */
+ private boolean isValidInterval(Integer interval) {
+ return interval != null;
+ }
+
+ /**
+ * Gets whether the Charging Station has been registered within the CSMS.
+ *
+ * @return Whether the Charging Station has been registered within the CSMS
+ */
+ public RegistrationStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station has been registered within the CSMS.
+ *
+ * @param status Whether the Charging Station has been registered within the CSMS
+ */
+ public void setStatus(RegistrationStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(RegistrationStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public BootNotificationResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidCurrentTime(currentTime)
+ && isValidInterval(interval)
+ && isValidStatus(status)
+ && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ BootNotificationResponse that = (BootNotificationResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(currentTime, that.currentTime)
+ && Objects.equals(interval, that.interval)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, currentTime, interval, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("currentTime", currentTime)
+ .add("interval", interval)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CancelReservationRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CancelReservationRequest.java
new file mode 100644
index 000000000..a5e36b465
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CancelReservationRequest.java
@@ -0,0 +1,165 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * CancelReservationRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class CancelReservationRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Id of the reservation to cancel. */
+ private Integer reservationId;
+
+ /**
+ * Constructor for the CancelReservationRequest class
+ *
+ * @param reservationId Id of the reservation to cancel.
+ */
+ public CancelReservationRequest(Integer reservationId) {
+ setReservationId(reservationId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public CancelReservationRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets id of the reservation to cancel.
+ *
+ * @return Id of the reservation to cancel
+ */
+ public Integer getReservationId() {
+ return reservationId;
+ }
+
+ /**
+ * Sets id of the reservation to cancel.
+ *
+ * @param reservationId Id of the reservation to cancel
+ */
+ public void setReservationId(Integer reservationId) {
+ if (!isValidReservationId(reservationId)) {
+ throw new PropertyConstraintException(reservationId, "reservationId is invalid");
+ }
+ this.reservationId = reservationId;
+ }
+
+ /**
+ * Returns whether the given reservationId is valid
+ *
+ * @param reservationId the reservationId to check the validity of
+ * @return {@code true} if reservationId is valid, {@code false} if not
+ */
+ private boolean isValidReservationId(Integer reservationId) {
+ return reservationId != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidReservationId(reservationId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CancelReservationRequest that = (CancelReservationRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(reservationId, that.reservationId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, reservationId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("reservationId", reservationId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CancelReservationResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CancelReservationResponse.java
new file mode 100644
index 000000000..95e8b07a5
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CancelReservationResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CancelReservationStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * CancelReservationResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class CancelReservationResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The success or failure of the canceling of a reservation by CSMS. */
+ private CancelReservationStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the CancelReservationResponse class
+ *
+ * @param status The success or failure of the canceling of a reservation by CSMS.
+ */
+ public CancelReservationResponse(CancelReservationStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public CancelReservationResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the success or failure of the canceling of a reservation by CSMS.
+ *
+ * @return The success or failure of the canceling of a reservation by CSMS
+ */
+ public CancelReservationStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the success or failure of the canceling of a reservation by CSMS.
+ *
+ * @param status The success or failure of the canceling of a reservation by CSMS
+ */
+ public void setStatus(CancelReservationStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(CancelReservationStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public CancelReservationResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CancelReservationResponse that = (CancelReservationResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CertificateSignedRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CertificateSignedRequest.java
new file mode 100644
index 000000000..e23733346
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CertificateSignedRequest.java
@@ -0,0 +1,233 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CertificateSigningUseEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * CertificateSignedRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class CertificateSignedRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * The signed PEM encoded X.509 certificate. This can also contain the necessary sub CA
+ * certificates. In that case, the order of the bundle should follow the certificate chain,
+ * starting from the leaf certificate.
+ *
+ * The Configuration Variable MaxCertificateChainSize can be used to limit the maximum size of
+ * this field.
+ */
+ private String certificateChain;
+
+ /**
+ * The type of the signed certificate that is returned. When omitted the certificate is used for
+ * both the 15118 connection (if implemented) and the Charging Station to CSMS connection. This
+ * field is required when a typeOfCertificate was included in the SignCertificateRequest that
+ * requested this certificate to be signed AND both the 15118 connection and the Charging Station
+ * connection are implemented.
+ */
+ @Nullable private CertificateSigningUseEnum certificateType;
+
+ /**
+ * Constructor for the CertificateSignedRequest class
+ *
+ * @param certificateChain The signed PEM encoded X.509 certificate. This can also contain the
+ * necessary sub CA certificates. In that case, the order of the bundle should follow the
+ * certificate chain, starting from the leaf certificate.
+ */
+ public CertificateSignedRequest(String certificateChain) {
+ setCertificateChain(certificateChain);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public CertificateSignedRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the signed PEM encoded X.509 certificate. This can also contain the necessary sub CA
+ * certificates. In that case, the order of the bundle should follow the certificate chain,
+ * starting from the leaf certificate.
+ *
+ * @return The signed PEM encoded X.509 certificate
+ */
+ public String getCertificateChain() {
+ return certificateChain;
+ }
+
+ /**
+ * Sets the signed PEM encoded X.509 certificate. This can also contain the necessary sub CA
+ * certificates. In that case, the order of the bundle should follow the certificate chain,
+ * starting from the leaf certificate.
+ *
+ * @param certificateChain The signed PEM encoded X.509 certificate
+ */
+ public void setCertificateChain(String certificateChain) {
+ if (!isValidCertificateChain(certificateChain)) {
+ throw new PropertyConstraintException(certificateChain, "certificateChain is invalid");
+ }
+ this.certificateChain = certificateChain;
+ }
+
+ /**
+ * Returns whether the given certificateChain is valid
+ *
+ * @param certificateChain the certificateChain to check the validity of
+ * @return {@code true} if certificateChain is valid, {@code false} if not
+ */
+ private boolean isValidCertificateChain(String certificateChain) {
+ return certificateChain != null && certificateChain.length() <= 10000;
+ }
+
+ /**
+ * Gets the type of the signed certificate that is returned. When omitted the certificate is used
+ * for both the 15118 connection (if implemented) and the Charging Station to CSMS connection.
+ * This field is required when a typeOfCertificate was included in the SignCertificateRequest that
+ * requested this certificate to be signed AND both the 15118 connection and the Charging Station
+ * connection are implemented.
+ *
+ * @return The type of the signed certificate that is returned
+ */
+ @Nullable
+ public CertificateSigningUseEnum getCertificateType() {
+ return certificateType;
+ }
+
+ /**
+ * Sets the type of the signed certificate that is returned. When omitted the certificate is used
+ * for both the 15118 connection (if implemented) and the Charging Station to CSMS connection.
+ * This field is required when a typeOfCertificate was included in the SignCertificateRequest that
+ * requested this certificate to be signed AND both the 15118 connection and the Charging Station
+ * connection are implemented.
+ *
+ * @param certificateType The type of the signed certificate that is returned
+ */
+ public void setCertificateType(@Nullable CertificateSigningUseEnum certificateType) {
+ this.certificateType = certificateType;
+ }
+
+ /**
+ * Adds the type of the signed certificate that is returned. When omitted the certificate is used
+ * for both the 15118 connection (if implemented) and the Charging Station to CSMS connection.
+ * This field is required when a typeOfCertificate was included in the SignCertificateRequest that
+ * requested this certificate to be signed AND both the 15118 connection and the Charging Station
+ * connection are implemented.
+ *
+ * @param certificateType The type of the signed certificate that is returned
+ * @return this
+ */
+ public CertificateSignedRequest withCertificateType(
+ @Nullable CertificateSigningUseEnum certificateType) {
+ setCertificateType(certificateType);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidCertificateChain(certificateChain);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CertificateSignedRequest that = (CertificateSignedRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(certificateChain, that.certificateChain)
+ && Objects.equals(certificateType, that.certificateType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, certificateChain, certificateType);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("certificateChain", certificateChain)
+ .add("certificateType", certificateType)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CertificateSignedResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CertificateSignedResponse.java
new file mode 100644
index 000000000..ac2a0c81c
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CertificateSignedResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CertificateSignedStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * CertificateSignedResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class CertificateSignedResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Returns whether certificate signing has been accepted, otherwise rejected. */
+ private CertificateSignedStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the CertificateSignedResponse class
+ *
+ * @param status Returns whether certificate signing has been accepted, otherwise rejected.
+ */
+ public CertificateSignedResponse(CertificateSignedStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public CertificateSignedResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets returns whether certificate signing has been accepted, otherwise rejected.
+ *
+ * @return Returns whether certificate signing has been accepted, otherwise rejected
+ */
+ public CertificateSignedStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets returns whether certificate signing has been accepted, otherwise rejected.
+ *
+ * @param status Returns whether certificate signing has been accepted, otherwise rejected
+ */
+ public void setStatus(CertificateSignedStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(CertificateSignedStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public CertificateSignedResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CertificateSignedResponse that = (CertificateSignedResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ChangeAvailabilityRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ChangeAvailabilityRequest.java
new file mode 100644
index 000000000..c7fd303ab
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ChangeAvailabilityRequest.java
@@ -0,0 +1,223 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.EVSE;
+import eu.chargetime.ocpp.v201.model.types.OperationalStatusEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ChangeAvailabilityRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ChangeAvailabilityRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * EVSE
+ *
+ * Electric Vehicle Supply Equipment
+ */
+ @Nullable private EVSE evse;
+
+ /** The type of availability change that the Charging Station should perform. */
+ private OperationalStatusEnum operationalStatus;
+
+ /**
+ * Constructor for the ChangeAvailabilityRequest class
+ *
+ * @param operationalStatus The type of availability change that the Charging Station should
+ * perform.
+ */
+ public ChangeAvailabilityRequest(OperationalStatusEnum operationalStatus) {
+ setOperationalStatus(operationalStatus);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ChangeAvailabilityRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets electric Vehicle Supply Equipment
+ *
+ * @return Electric Vehicle Supply Equipment
+ */
+ @Nullable
+ public EVSE getEvse() {
+ return evse;
+ }
+
+ /**
+ * Sets electric Vehicle Supply Equipment
+ *
+ * @param evse Electric Vehicle Supply Equipment
+ */
+ public void setEvse(@Nullable EVSE evse) {
+ if (!isValidEvse(evse)) {
+ throw new PropertyConstraintException(evse, "evse is invalid");
+ }
+ this.evse = evse;
+ }
+
+ /**
+ * Returns whether the given evse is valid
+ *
+ * @param evse the evse to check the validity of
+ * @return {@code true} if evse is valid, {@code false} if not
+ */
+ private boolean isValidEvse(@Nullable EVSE evse) {
+ return evse == null || evse.validate();
+ }
+
+ /**
+ * Adds electric Vehicle Supply Equipment
+ *
+ * @param evse Electric Vehicle Supply Equipment
+ * @return this
+ */
+ public ChangeAvailabilityRequest withEvse(@Nullable EVSE evse) {
+ setEvse(evse);
+ return this;
+ }
+
+ /**
+ * Gets the type of availability change that the Charging Station should perform.
+ *
+ * @return The type of availability change that the Charging Station should perform
+ */
+ public OperationalStatusEnum getOperationalStatus() {
+ return operationalStatus;
+ }
+
+ /**
+ * Sets the type of availability change that the Charging Station should perform.
+ *
+ * @param operationalStatus The type of availability change that the Charging Station should
+ * perform
+ */
+ public void setOperationalStatus(OperationalStatusEnum operationalStatus) {
+ if (!isValidOperationalStatus(operationalStatus)) {
+ throw new PropertyConstraintException(operationalStatus, "operationalStatus is invalid");
+ }
+ this.operationalStatus = operationalStatus;
+ }
+
+ /**
+ * Returns whether the given operationalStatus is valid
+ *
+ * @param operationalStatus the operationalStatus to check the validity of
+ * @return {@code true} if operationalStatus is valid, {@code false} if not
+ */
+ private boolean isValidOperationalStatus(OperationalStatusEnum operationalStatus) {
+ return operationalStatus != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidEvse(evse)
+ && isValidOperationalStatus(operationalStatus);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ChangeAvailabilityRequest that = (ChangeAvailabilityRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(evse, that.evse)
+ && Objects.equals(operationalStatus, that.operationalStatus);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, evse, operationalStatus);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("evse", evse)
+ .add("operationalStatus", operationalStatus)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ChangeAvailabilityResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ChangeAvailabilityResponse.java
new file mode 100644
index 000000000..68b5a1eda
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ChangeAvailabilityResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ChangeAvailabilityStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ChangeAvailabilityResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ChangeAvailabilityResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the Charging Station is able to perform the availability change. */
+ private ChangeAvailabilityStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the ChangeAvailabilityResponse class
+ *
+ * @param status Whether the Charging Station is able to perform the availability change.
+ */
+ public ChangeAvailabilityResponse(ChangeAvailabilityStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ChangeAvailabilityResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Charging Station is able to perform the availability change.
+ *
+ * @return Whether the Charging Station is able to perform the availability change
+ */
+ public ChangeAvailabilityStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station is able to perform the availability change.
+ *
+ * @param status Whether the Charging Station is able to perform the availability change
+ */
+ public void setStatus(ChangeAvailabilityStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(ChangeAvailabilityStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public ChangeAvailabilityResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ChangeAvailabilityResponse that = (ChangeAvailabilityResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearCacheRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearCacheRequest.java
new file mode 100644
index 000000000..12e447783
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearCacheRequest.java
@@ -0,0 +1,123 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ClearCacheRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ClearCacheRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the ClearCacheRequest class */
+ public ClearCacheRequest() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ClearCacheRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ClearCacheRequest that = (ClearCacheRequest) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearCacheResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearCacheResponse.java
new file mode 100644
index 000000000..c081b7496
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearCacheResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ClearCacheStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ClearCacheResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ClearCacheResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Accepted if the Charging Station has executed the request, otherwise rejected. */
+ private ClearCacheStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the ClearCacheResponse class
+ *
+ * @param status Accepted if the Charging Station has executed the request, otherwise rejected.
+ */
+ public ClearCacheResponse(ClearCacheStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ClearCacheResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets accepted if the Charging Station has executed the request, otherwise rejected.
+ *
+ * @return Accepted if the Charging Station has executed the request, otherwise rejected
+ */
+ public ClearCacheStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets accepted if the Charging Station has executed the request, otherwise rejected.
+ *
+ * @param status Accepted if the Charging Station has executed the request, otherwise rejected
+ */
+ public void setStatus(ClearCacheStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(ClearCacheStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public ClearCacheResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ClearCacheResponse that = (ClearCacheResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearChargingProfileRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearChargingProfileRequest.java
new file mode 100644
index 000000000..84c1a55bd
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearChargingProfileRequest.java
@@ -0,0 +1,221 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ClearChargingProfile;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ClearChargingProfileRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ClearChargingProfileRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The Id of the charging profile to clear. */
+ @Nullable private Integer chargingProfileId;
+
+ /**
+ * Charging Profile
+ *
+ * A ChargingProfile consists of a ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ */
+ @Nullable private ClearChargingProfile chargingProfileCriteria;
+
+ /** Constructor for the ClearChargingProfileRequest class */
+ public ClearChargingProfileRequest() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ClearChargingProfileRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the Id of the charging profile to clear.
+ *
+ * @return The Id of the charging profile to clear
+ */
+ @Nullable
+ public Integer getChargingProfileId() {
+ return chargingProfileId;
+ }
+
+ /**
+ * Sets the Id of the charging profile to clear.
+ *
+ * @param chargingProfileId The Id of the charging profile to clear
+ */
+ public void setChargingProfileId(@Nullable Integer chargingProfileId) {
+ this.chargingProfileId = chargingProfileId;
+ }
+
+ /**
+ * Adds the Id of the charging profile to clear.
+ *
+ * @param chargingProfileId The Id of the charging profile to clear
+ * @return this
+ */
+ public ClearChargingProfileRequest withChargingProfileId(@Nullable Integer chargingProfileId) {
+ setChargingProfileId(chargingProfileId);
+ return this;
+ }
+
+ /**
+ * Gets a ChargingProfile consists of a ChargingSchedule, describing the amount of power or
+ * current that can be delivered per time interval.
+ *
+ * @return A ChargingProfile consists of a ChargingSchedule, describing the amount of power or
+ * current that can be delivered per time interval
+ */
+ @Nullable
+ public ClearChargingProfile getChargingProfileCriteria() {
+ return chargingProfileCriteria;
+ }
+
+ /**
+ * Sets a ChargingProfile consists of a ChargingSchedule, describing the amount of power or
+ * current that can be delivered per time interval.
+ *
+ * @param chargingProfileCriteria A ChargingProfile consists of a ChargingSchedule, describing the
+ * amount of power or current that can be delivered per time interval
+ */
+ public void setChargingProfileCriteria(@Nullable ClearChargingProfile chargingProfileCriteria) {
+ if (!isValidChargingProfileCriteria(chargingProfileCriteria)) {
+ throw new PropertyConstraintException(
+ chargingProfileCriteria, "chargingProfileCriteria is invalid");
+ }
+ this.chargingProfileCriteria = chargingProfileCriteria;
+ }
+
+ /**
+ * Returns whether the given chargingProfileCriteria is valid
+ *
+ * @param chargingProfileCriteria the chargingProfileCriteria to check the validity of
+ * @return {@code true} if chargingProfileCriteria is valid, {@code false} if not
+ */
+ private boolean isValidChargingProfileCriteria(
+ @Nullable ClearChargingProfile chargingProfileCriteria) {
+ return chargingProfileCriteria == null || chargingProfileCriteria.validate();
+ }
+
+ /**
+ * Adds a ChargingProfile consists of a ChargingSchedule, describing the amount of power or
+ * current that can be delivered per time interval.
+ *
+ * @param chargingProfileCriteria A ChargingProfile consists of a ChargingSchedule, describing the
+ * amount of power or current that can be delivered per time interval
+ * @return this
+ */
+ public ClearChargingProfileRequest withChargingProfileCriteria(
+ @Nullable ClearChargingProfile chargingProfileCriteria) {
+ setChargingProfileCriteria(chargingProfileCriteria);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidChargingProfileCriteria(chargingProfileCriteria);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ClearChargingProfileRequest that = (ClearChargingProfileRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(chargingProfileId, that.chargingProfileId)
+ && Objects.equals(chargingProfileCriteria, that.chargingProfileCriteria);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, chargingProfileId, chargingProfileCriteria);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("chargingProfileId", chargingProfileId)
+ .add("chargingProfileCriteria", chargingProfileCriteria)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearChargingProfileResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearChargingProfileResponse.java
new file mode 100644
index 000000000..4c4071c2e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearChargingProfileResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ClearChargingProfileStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ClearChargingProfileResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ClearChargingProfileResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the Charging Station was able to execute the request. */
+ private ClearChargingProfileStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the ClearChargingProfileResponse class
+ *
+ * @param status Whether the Charging Station was able to execute the request.
+ */
+ public ClearChargingProfileResponse(ClearChargingProfileStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ClearChargingProfileResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Charging Station was able to execute the request.
+ *
+ * @return Whether the Charging Station was able to execute the request
+ */
+ public ClearChargingProfileStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station was able to execute the request.
+ *
+ * @param status Whether the Charging Station was able to execute the request
+ */
+ public void setStatus(ClearChargingProfileStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(ClearChargingProfileStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public ClearChargingProfileResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ClearChargingProfileResponse that = (ClearChargingProfileResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearDisplayMessageRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearDisplayMessageRequest.java
new file mode 100644
index 000000000..24be20acf
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearDisplayMessageRequest.java
@@ -0,0 +1,164 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ClearDisplayMessageRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ClearDisplayMessageRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Id of the message that SHALL be removed from the Charging Station. */
+ private Integer id;
+
+ /**
+ * Constructor for the ClearDisplayMessageRequest class
+ *
+ * @param id Id of the message that SHALL be removed from the Charging Station.
+ */
+ public ClearDisplayMessageRequest(Integer id) {
+ setId(id);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ClearDisplayMessageRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets id of the message that SHALL be removed from the Charging Station.
+ *
+ * @return Id of the message that SHALL be removed from the Charging Station
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * Sets id of the message that SHALL be removed from the Charging Station.
+ *
+ * @param id Id of the message that SHALL be removed from the Charging Station
+ */
+ public void setId(Integer id) {
+ if (!isValidId(id)) {
+ throw new PropertyConstraintException(id, "id is invalid");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Returns whether the given id is valid
+ *
+ * @param id the id to check the validity of
+ * @return {@code true} if id is valid, {@code false} if not
+ */
+ private boolean isValidId(Integer id) {
+ return id != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidId(id);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ClearDisplayMessageRequest that = (ClearDisplayMessageRequest) o;
+ return Objects.equals(customData, that.customData) && Objects.equals(id, that.id);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, id);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("id", id)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearDisplayMessageResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearDisplayMessageResponse.java
new file mode 100644
index 000000000..e834fee67
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearDisplayMessageResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ClearMessageStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ClearDisplayMessageResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ClearDisplayMessageResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Returns whether the Charging Station has been able to remove the message. */
+ private ClearMessageStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the ClearDisplayMessageResponse class
+ *
+ * @param status Returns whether the Charging Station has been able to remove the message.
+ */
+ public ClearDisplayMessageResponse(ClearMessageStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ClearDisplayMessageResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets returns whether the Charging Station has been able to remove the message.
+ *
+ * @return Returns whether the Charging Station has been able to remove the message
+ */
+ public ClearMessageStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets returns whether the Charging Station has been able to remove the message.
+ *
+ * @param status Returns whether the Charging Station has been able to remove the message
+ */
+ public void setStatus(ClearMessageStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(ClearMessageStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public ClearDisplayMessageResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ClearDisplayMessageResponse that = (ClearDisplayMessageResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearVariableMonitoringRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearVariableMonitoringRequest.java
new file mode 100644
index 000000000..a931548a6
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearVariableMonitoringRequest.java
@@ -0,0 +1,165 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ClearVariableMonitoringRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ClearVariableMonitoringRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** List of the monitors to be cleared, identified by there Id. */
+ private Integer[] id;
+
+ /**
+ * Constructor for the ClearVariableMonitoringRequest class
+ *
+ * @param id List of the monitors to be cleared, identified by there Id.
+ */
+ public ClearVariableMonitoringRequest(Integer[] id) {
+ setId(id);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ClearVariableMonitoringRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets list of the monitors to be cleared, identified by there Id.
+ *
+ * @return List of the monitors to be cleared, identified by there Id
+ */
+ public Integer[] getId() {
+ return id;
+ }
+
+ /**
+ * Sets list of the monitors to be cleared, identified by there Id.
+ *
+ * @param id List of the monitors to be cleared, identified by there Id
+ */
+ public void setId(Integer[] id) {
+ if (!isValidId(id)) {
+ throw new PropertyConstraintException(id, "id is invalid");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Returns whether the given id is valid
+ *
+ * @param id the id to check the validity of
+ * @return {@code true} if id is valid, {@code false} if not
+ */
+ private boolean isValidId(Integer[] id) {
+ return id != null && id.length >= 1;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidId(id);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ClearVariableMonitoringRequest that = (ClearVariableMonitoringRequest) o;
+ return Objects.equals(customData, that.customData) && Arrays.equals(id, that.id);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(id));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("id", id)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearVariableMonitoringResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearVariableMonitoringResponse.java
new file mode 100644
index 000000000..e3beb324f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearVariableMonitoringResponse.java
@@ -0,0 +1,165 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ClearMonitoringResult;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ClearVariableMonitoringResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ClearVariableMonitoringResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** clearMonitoringResult */
+ private ClearMonitoringResult[] clearMonitoringResult;
+
+ /**
+ * Constructor for the ClearVariableMonitoringResponse class
+ *
+ * @param clearMonitoringResult clearMonitoringResult
+ */
+ public ClearVariableMonitoringResponse(ClearMonitoringResult[] clearMonitoringResult) {
+ setClearMonitoringResult(clearMonitoringResult);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ClearVariableMonitoringResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets clearMonitoringResult
+ *
+ * @return clearMonitoringResult
+ */
+ public ClearMonitoringResult[] getClearMonitoringResult() {
+ return clearMonitoringResult;
+ }
+
+ /**
+ * Sets clearMonitoringResult
+ *
+ * @param clearMonitoringResult clearMonitoringResult
+ */
+ public void setClearMonitoringResult(ClearMonitoringResult[] clearMonitoringResult) {
+ if (!isValidClearMonitoringResult(clearMonitoringResult)) {
+ throw new PropertyConstraintException(
+ clearMonitoringResult, "clearMonitoringResult is invalid");
+ }
+ this.clearMonitoringResult = clearMonitoringResult;
+ }
+
+ /**
+ * Returns whether the given clearMonitoringResult is valid
+ *
+ * @param clearMonitoringResult the clearMonitoringResult to check the validity of
+ * @return {@code true} if clearMonitoringResult is valid, {@code false} if not
+ */
+ private boolean isValidClearMonitoringResult(ClearMonitoringResult[] clearMonitoringResult) {
+ return clearMonitoringResult != null
+ && clearMonitoringResult.length >= 1
+ && Arrays.stream(clearMonitoringResult).allMatch(item -> item.validate());
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidClearMonitoringResult(clearMonitoringResult);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ClearVariableMonitoringResponse that = (ClearVariableMonitoringResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(clearMonitoringResult, that.clearMonitoringResult);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(clearMonitoringResult));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("clearMonitoringResult", clearMonitoringResult)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearedChargingLimitRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearedChargingLimitRequest.java
new file mode 100644
index 000000000..0b54af960
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearedChargingLimitRequest.java
@@ -0,0 +1,201 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ChargingLimitSourceEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ClearedChargingLimitRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ClearedChargingLimitRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Source of the charging limit. */
+ private ChargingLimitSourceEnum chargingLimitSource;
+
+ /** EVSE Identifier. */
+ @Nullable private Integer evseId;
+
+ /**
+ * Constructor for the ClearedChargingLimitRequest class
+ *
+ * @param chargingLimitSource Source of the charging limit.
+ */
+ public ClearedChargingLimitRequest(ChargingLimitSourceEnum chargingLimitSource) {
+ setChargingLimitSource(chargingLimitSource);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ClearedChargingLimitRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets source of the charging limit.
+ *
+ * @return Source of the charging limit
+ */
+ public ChargingLimitSourceEnum getChargingLimitSource() {
+ return chargingLimitSource;
+ }
+
+ /**
+ * Sets source of the charging limit.
+ *
+ * @param chargingLimitSource Source of the charging limit
+ */
+ public void setChargingLimitSource(ChargingLimitSourceEnum chargingLimitSource) {
+ if (!isValidChargingLimitSource(chargingLimitSource)) {
+ throw new PropertyConstraintException(chargingLimitSource, "chargingLimitSource is invalid");
+ }
+ this.chargingLimitSource = chargingLimitSource;
+ }
+
+ /**
+ * Returns whether the given chargingLimitSource is valid
+ *
+ * @param chargingLimitSource the chargingLimitSource to check the validity of
+ * @return {@code true} if chargingLimitSource is valid, {@code false} if not
+ */
+ private boolean isValidChargingLimitSource(ChargingLimitSourceEnum chargingLimitSource) {
+ return chargingLimitSource != null;
+ }
+
+ /**
+ * Gets EVSE Identifier.
+ *
+ * @return EVSE Identifier
+ */
+ @Nullable
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets EVSE Identifier.
+ *
+ * @param evseId EVSE Identifier
+ */
+ public void setEvseId(@Nullable Integer evseId) {
+ this.evseId = evseId;
+ }
+
+ /**
+ * Adds EVSE Identifier.
+ *
+ * @param evseId EVSE Identifier
+ * @return this
+ */
+ public ClearedChargingLimitRequest withEvseId(@Nullable Integer evseId) {
+ setEvseId(evseId);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidChargingLimitSource(chargingLimitSource);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ClearedChargingLimitRequest that = (ClearedChargingLimitRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(chargingLimitSource, that.chargingLimitSource)
+ && Objects.equals(evseId, that.evseId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, chargingLimitSource, evseId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("chargingLimitSource", chargingLimitSource)
+ .add("evseId", evseId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearedChargingLimitResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearedChargingLimitResponse.java
new file mode 100644
index 000000000..3f41b650f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ClearedChargingLimitResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ClearedChargingLimitResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ClearedChargingLimitResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the ClearedChargingLimitResponse class */
+ public ClearedChargingLimitResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ClearedChargingLimitResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ClearedChargingLimitResponse that = (ClearedChargingLimitResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CostUpdatedRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CostUpdatedRequest.java
new file mode 100644
index 000000000..33a882c69
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CostUpdatedRequest.java
@@ -0,0 +1,214 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * CostUpdatedRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class CostUpdatedRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Current total cost, based on the information known by the CSMS, of the transaction including
+ * taxes. In the currency configured with the configuration Variable: [Currency]
+ */
+ private Double totalCost;
+
+ /** Transaction Id of the transaction the current cost are asked for. */
+ private String transactionId;
+
+ /**
+ * Constructor for the CostUpdatedRequest class
+ *
+ * @param totalCost Current total cost, based on the information known by the CSMS, of the
+ * transaction including taxes. In the currency configured with the configuration Variable:
+ * [Currency]
+ * @param transactionId Transaction Id of the transaction the current cost are asked for.
+ */
+ public CostUpdatedRequest(Double totalCost, String transactionId) {
+ setTotalCost(totalCost);
+ setTransactionId(transactionId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public CostUpdatedRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets current total cost, based on the information known by the CSMS, of the transaction
+ * including taxes. In the currency configured with the configuration Variable: [Currency]
+ *
+ * @return Current total cost, based on the information known by the CSMS, of the transaction
+ * including taxes
+ */
+ public Double getTotalCost() {
+ return totalCost;
+ }
+
+ /**
+ * Sets current total cost, based on the information known by the CSMS, of the transaction
+ * including taxes. In the currency configured with the configuration Variable: [Currency]
+ *
+ * @param totalCost Current total cost, based on the information known by the CSMS, of the
+ * transaction including taxes
+ */
+ public void setTotalCost(Double totalCost) {
+ if (!isValidTotalCost(totalCost)) {
+ throw new PropertyConstraintException(totalCost, "totalCost is invalid");
+ }
+ this.totalCost = totalCost;
+ }
+
+ /**
+ * Returns whether the given totalCost is valid
+ *
+ * @param totalCost the totalCost to check the validity of
+ * @return {@code true} if totalCost is valid, {@code false} if not
+ */
+ private boolean isValidTotalCost(Double totalCost) {
+ return totalCost != null;
+ }
+
+ /**
+ * Gets transaction Id of the transaction the current cost are asked for.
+ *
+ * @return Transaction Id of the transaction the current cost are asked for
+ */
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ /**
+ * Sets transaction Id of the transaction the current cost are asked for.
+ *
+ * @param transactionId Transaction Id of the transaction the current cost are asked for
+ */
+ public void setTransactionId(String transactionId) {
+ if (!isValidTransactionId(transactionId)) {
+ throw new PropertyConstraintException(transactionId, "transactionId is invalid");
+ }
+ this.transactionId = transactionId;
+ }
+
+ /**
+ * Returns whether the given transactionId is valid
+ *
+ * @param transactionId the transactionId to check the validity of
+ * @return {@code true} if transactionId is valid, {@code false} if not
+ */
+ private boolean isValidTransactionId(String transactionId) {
+ return transactionId != null && transactionId.length() <= 36;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidTotalCost(totalCost)
+ && isValidTransactionId(transactionId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CostUpdatedRequest that = (CostUpdatedRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(totalCost, that.totalCost)
+ && Objects.equals(transactionId, that.transactionId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, totalCost, transactionId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("totalCost", totalCost)
+ .add("transactionId", transactionId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CostUpdatedResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CostUpdatedResponse.java
new file mode 100644
index 000000000..70a5c633e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CostUpdatedResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * CostUpdatedResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class CostUpdatedResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the CostUpdatedResponse class */
+ public CostUpdatedResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public CostUpdatedResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CostUpdatedResponse that = (CostUpdatedResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CustomerInformationRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CustomerInformationRequest.java
new file mode 100644
index 000000000..80234ecca
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CustomerInformationRequest.java
@@ -0,0 +1,440 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CertificateHashData;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.IdToken;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * CustomerInformationRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class CustomerInformationRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** customerCertificate */
+ @Nullable private CertificateHashData customerCertificate;
+
+ /**
+ * A case insensitive identifier to use for the authorization and the type of authorization to
+ * support multiple forms of identifiers.
+ */
+ @Nullable private IdToken idToken;
+
+ /** The Id of the request. */
+ private Integer requestId;
+
+ /**
+ * Flag indicating whether the Charging Station should return NotifyCustomerInformationRequest
+ * messages containing information about the customer referred to.
+ */
+ private Boolean report;
+
+ /**
+ * Flag indicating whether the Charging Station should clear all information about the customer
+ * referred to.
+ */
+ private Boolean clear;
+
+ /**
+ * A (e.g. vendor specific) identifier of the customer this request refers to. This field contains
+ * a custom identifier other than IdToken and Certificate. One of the possible identifiers
+ * (customerIdentifier, customerIdToken or customerCertificate) should be in the request message.
+ */
+ @Nullable private String customerIdentifier;
+
+ /**
+ * Constructor for the CustomerInformationRequest class
+ *
+ * @param requestId The Id of the request.
+ * @param report Flag indicating whether the Charging Station should return
+ * NotifyCustomerInformationRequest messages containing information about the customer
+ * referred to.
+ * @param clear Flag indicating whether the Charging Station should clear all information about
+ * the customer referred to.
+ */
+ public CustomerInformationRequest(Integer requestId, Boolean report, Boolean clear) {
+ setRequestId(requestId);
+ setReport(report);
+ setClear(clear);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public CustomerInformationRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets customerCertificate
+ *
+ * @return customerCertificate
+ */
+ @Nullable
+ public CertificateHashData getCustomerCertificate() {
+ return customerCertificate;
+ }
+
+ /**
+ * Sets customerCertificate
+ *
+ * @param customerCertificate customerCertificate
+ */
+ public void setCustomerCertificate(@Nullable CertificateHashData customerCertificate) {
+ if (!isValidCustomerCertificate(customerCertificate)) {
+ throw new PropertyConstraintException(customerCertificate, "customerCertificate is invalid");
+ }
+ this.customerCertificate = customerCertificate;
+ }
+
+ /**
+ * Returns whether the given customerCertificate is valid
+ *
+ * @param customerCertificate the customerCertificate to check the validity of
+ * @return {@code true} if customerCertificate is valid, {@code false} if not
+ */
+ private boolean isValidCustomerCertificate(@Nullable CertificateHashData customerCertificate) {
+ return customerCertificate == null || customerCertificate.validate();
+ }
+
+ /**
+ * Adds customerCertificate
+ *
+ * @param customerCertificate customerCertificate
+ * @return this
+ */
+ public CustomerInformationRequest withCustomerCertificate(
+ @Nullable CertificateHashData customerCertificate) {
+ setCustomerCertificate(customerCertificate);
+ return this;
+ }
+
+ /**
+ * Gets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @return A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ @Nullable
+ public IdToken getIdToken() {
+ return idToken;
+ }
+
+ /**
+ * Sets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param idToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public void setIdToken(@Nullable IdToken idToken) {
+ if (!isValidIdToken(idToken)) {
+ throw new PropertyConstraintException(idToken, "idToken is invalid");
+ }
+ this.idToken = idToken;
+ }
+
+ /**
+ * Returns whether the given idToken is valid
+ *
+ * @param idToken the idToken to check the validity of
+ * @return {@code true} if idToken is valid, {@code false} if not
+ */
+ private boolean isValidIdToken(@Nullable IdToken idToken) {
+ return idToken == null || idToken.validate();
+ }
+
+ /**
+ * Adds a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param idToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ * @return this
+ */
+ public CustomerInformationRequest withIdToken(@Nullable IdToken idToken) {
+ setIdToken(idToken);
+ return this;
+ }
+
+ /**
+ * Gets the Id of the request.
+ *
+ * @return The Id of the request
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the Id of the request.
+ *
+ * @param requestId The Id of the request
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets flag indicating whether the Charging Station should return
+ * NotifyCustomerInformationRequest messages containing information about the customer referred
+ * to.
+ *
+ * @return Flag indicating whether the Charging Station should return
+ * NotifyCustomerInformationRequest messages containing information about the customer
+ * referred to
+ */
+ public Boolean getReport() {
+ return report;
+ }
+
+ /**
+ * Sets flag indicating whether the Charging Station should return
+ * NotifyCustomerInformationRequest messages containing information about the customer referred
+ * to.
+ *
+ * @param report Flag indicating whether the Charging Station should return
+ * NotifyCustomerInformationRequest messages containing information about the customer
+ * referred to
+ */
+ public void setReport(Boolean report) {
+ if (!isValidReport(report)) {
+ throw new PropertyConstraintException(report, "report is invalid");
+ }
+ this.report = report;
+ }
+
+ /**
+ * Returns whether the given report is valid
+ *
+ * @param report the report to check the validity of
+ * @return {@code true} if report is valid, {@code false} if not
+ */
+ private boolean isValidReport(Boolean report) {
+ return report != null;
+ }
+
+ /**
+ * Gets flag indicating whether the Charging Station should clear all information about the
+ * customer referred to.
+ *
+ * @return Flag indicating whether the Charging Station should clear all information about the
+ * customer referred to
+ */
+ public Boolean getClear() {
+ return clear;
+ }
+
+ /**
+ * Sets flag indicating whether the Charging Station should clear all information about the
+ * customer referred to.
+ *
+ * @param clear Flag indicating whether the Charging Station should clear all information about
+ * the customer referred to
+ */
+ public void setClear(Boolean clear) {
+ if (!isValidClear(clear)) {
+ throw new PropertyConstraintException(clear, "clear is invalid");
+ }
+ this.clear = clear;
+ }
+
+ /**
+ * Returns whether the given clear is valid
+ *
+ * @param clear the clear to check the validity of
+ * @return {@code true} if clear is valid, {@code false} if not
+ */
+ private boolean isValidClear(Boolean clear) {
+ return clear != null;
+ }
+
+ /**
+ * Gets a (e.g. vendor specific) identifier of the customer this request refers to. This field
+ * contains a custom identifier other than IdToken and Certificate. One of the possible
+ * identifiers (customerIdentifier, customerIdToken or customerCertificate) should be in the
+ * request message.
+ *
+ * @return A (e.g. vendor specific) identifier of the customer this request refers to
+ */
+ @Nullable
+ public String getCustomerIdentifier() {
+ return customerIdentifier;
+ }
+
+ /**
+ * Sets a (e.g. vendor specific) identifier of the customer this request refers to. This field
+ * contains a custom identifier other than IdToken and Certificate. One of the possible
+ * identifiers (customerIdentifier, customerIdToken or customerCertificate) should be in the
+ * request message.
+ *
+ * @param customerIdentifier A (e.g. vendor specific) identifier of the customer this request
+ * refers to
+ */
+ public void setCustomerIdentifier(@Nullable String customerIdentifier) {
+ if (!isValidCustomerIdentifier(customerIdentifier)) {
+ throw new PropertyConstraintException(customerIdentifier, "customerIdentifier is invalid");
+ }
+ this.customerIdentifier = customerIdentifier;
+ }
+
+ /**
+ * Returns whether the given customerIdentifier is valid
+ *
+ * @param customerIdentifier the customerIdentifier to check the validity of
+ * @return {@code true} if customerIdentifier is valid, {@code false} if not
+ */
+ private boolean isValidCustomerIdentifier(@Nullable String customerIdentifier) {
+ return customerIdentifier == null || customerIdentifier.length() <= 64;
+ }
+
+ /**
+ * Adds a (e.g. vendor specific) identifier of the customer this request refers to. This field
+ * contains a custom identifier other than IdToken and Certificate. One of the possible
+ * identifiers (customerIdentifier, customerIdToken or customerCertificate) should be in the
+ * request message.
+ *
+ * @param customerIdentifier A (e.g. vendor specific) identifier of the customer this request
+ * refers to
+ * @return this
+ */
+ public CustomerInformationRequest withCustomerIdentifier(@Nullable String customerIdentifier) {
+ setCustomerIdentifier(customerIdentifier);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidCustomerCertificate(customerCertificate)
+ && isValidIdToken(idToken)
+ && isValidRequestId(requestId)
+ && isValidReport(report)
+ && isValidClear(clear)
+ && isValidCustomerIdentifier(customerIdentifier);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CustomerInformationRequest that = (CustomerInformationRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(customerCertificate, that.customerCertificate)
+ && Objects.equals(idToken, that.idToken)
+ && Objects.equals(requestId, that.requestId)
+ && Objects.equals(report, that.report)
+ && Objects.equals(clear, that.clear)
+ && Objects.equals(customerIdentifier, that.customerIdentifier);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, customerCertificate, idToken, requestId, report, clear, customerIdentifier);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("customerCertificate", customerCertificate)
+ .add("idToken", idToken)
+ .add("requestId", requestId)
+ .add("report", report)
+ .add("clear", clear)
+ .add("customerIdentifier", customerIdentifier)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CustomerInformationResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CustomerInformationResponse.java
new file mode 100644
index 000000000..ecf941126
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/CustomerInformationResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.CustomerInformationStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * CustomerInformationResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class CustomerInformationResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the request was accepted. */
+ private CustomerInformationStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the CustomerInformationResponse class
+ *
+ * @param status Whether the request was accepted.
+ */
+ public CustomerInformationResponse(CustomerInformationStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public CustomerInformationResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the request was accepted.
+ *
+ * @return Whether the request was accepted
+ */
+ public CustomerInformationStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the request was accepted.
+ *
+ * @param status Whether the request was accepted
+ */
+ public void setStatus(CustomerInformationStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(CustomerInformationStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public CustomerInformationResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CustomerInformationResponse that = (CustomerInformationResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/DataTransferRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/DataTransferRequest.java
new file mode 100644
index 000000000..ebd1c78f4
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/DataTransferRequest.java
@@ -0,0 +1,256 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * DataTransferRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class DataTransferRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** May be used to indicate a specific message or implementation. */
+ @Nullable private String messageId;
+
+ /**
+ * Data without specified length or format. This needs to be decided by both parties (Open to
+ * implementation).
+ */
+ @Nullable private Object data;
+
+ /** The identifier of the Vendor specific implementation */
+ private String vendorId;
+
+ /**
+ * Constructor for the DataTransferRequest class
+ *
+ * @param vendorId The identifier of the Vendor specific implementation
+ */
+ public DataTransferRequest(String vendorId) {
+ setVendorId(vendorId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public DataTransferRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets may be used to indicate a specific message or implementation.
+ *
+ * @return May be used to indicate a specific message or implementation
+ */
+ @Nullable
+ public String getMessageId() {
+ return messageId;
+ }
+
+ /**
+ * Sets may be used to indicate a specific message or implementation.
+ *
+ * @param messageId May be used to indicate a specific message or implementation
+ */
+ public void setMessageId(@Nullable String messageId) {
+ if (!isValidMessageId(messageId)) {
+ throw new PropertyConstraintException(messageId, "messageId is invalid");
+ }
+ this.messageId = messageId;
+ }
+
+ /**
+ * Returns whether the given messageId is valid
+ *
+ * @param messageId the messageId to check the validity of
+ * @return {@code true} if messageId is valid, {@code false} if not
+ */
+ private boolean isValidMessageId(@Nullable String messageId) {
+ return messageId == null || messageId.length() <= 50;
+ }
+
+ /**
+ * Adds may be used to indicate a specific message or implementation.
+ *
+ * @param messageId May be used to indicate a specific message or implementation
+ * @return this
+ */
+ public DataTransferRequest withMessageId(@Nullable String messageId) {
+ setMessageId(messageId);
+ return this;
+ }
+
+ /**
+ * Gets data without specified length or format. This needs to be decided by both parties (Open to
+ * implementation).
+ *
+ * @return Data without specified length or format
+ */
+ @Nullable
+ public Object getData() {
+ return data;
+ }
+
+ /**
+ * Sets data without specified length or format. This needs to be decided by both parties (Open to
+ * implementation).
+ *
+ * @param data Data without specified length or format
+ */
+ public void setData(@Nullable Object data) {
+ this.data = data;
+ }
+
+ /**
+ * Adds data without specified length or format. This needs to be decided by both parties (Open to
+ * implementation).
+ *
+ * @param data Data without specified length or format
+ * @return this
+ */
+ public DataTransferRequest withData(@Nullable Object data) {
+ setData(data);
+ return this;
+ }
+
+ /**
+ * Gets the identifier of the Vendor specific implementation
+ *
+ * @return The identifier of the Vendor specific implementation
+ */
+ public String getVendorId() {
+ return vendorId;
+ }
+
+ /**
+ * Sets the identifier of the Vendor specific implementation
+ *
+ * @param vendorId The identifier of the Vendor specific implementation
+ */
+ public void setVendorId(String vendorId) {
+ if (!isValidVendorId(vendorId)) {
+ throw new PropertyConstraintException(vendorId, "vendorId is invalid");
+ }
+ this.vendorId = vendorId;
+ }
+
+ /**
+ * Returns whether the given vendorId is valid
+ *
+ * @param vendorId the vendorId to check the validity of
+ * @return {@code true} if vendorId is valid, {@code false} if not
+ */
+ private boolean isValidVendorId(String vendorId) {
+ return vendorId != null && vendorId.length() <= 255;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidMessageId(messageId)
+ && isValidVendorId(vendorId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ DataTransferRequest that = (DataTransferRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(messageId, that.messageId)
+ && Objects.equals(data, that.data)
+ && Objects.equals(vendorId, that.vendorId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, messageId, data, vendorId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("messageId", messageId)
+ .add("data", data)
+ .add("vendorId", vendorId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/DataTransferResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/DataTransferResponse.java
new file mode 100644
index 000000000..ad7a7b43f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/DataTransferResponse.java
@@ -0,0 +1,245 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.DataTransferStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * DataTransferResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class DataTransferResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The success or failure of the data transfer. */
+ private DataTransferStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /** Data without specified length or format, in response to request. */
+ @Nullable private Object data;
+
+ /**
+ * Constructor for the DataTransferResponse class
+ *
+ * @param status The success or failure of the data transfer.
+ */
+ public DataTransferResponse(DataTransferStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public DataTransferResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the success or failure of the data transfer.
+ *
+ * @return The success or failure of the data transfer
+ */
+ public DataTransferStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the success or failure of the data transfer.
+ *
+ * @param status The success or failure of the data transfer
+ */
+ public void setStatus(DataTransferStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(DataTransferStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public DataTransferResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ /**
+ * Gets data without specified length or format, in response to request.
+ *
+ * @return Data without specified length or format, in response to request
+ */
+ @Nullable
+ public Object getData() {
+ return data;
+ }
+
+ /**
+ * Sets data without specified length or format, in response to request.
+ *
+ * @param data Data without specified length or format, in response to request
+ */
+ public void setData(@Nullable Object data) {
+ this.data = data;
+ }
+
+ /**
+ * Adds data without specified length or format, in response to request.
+ *
+ * @param data Data without specified length or format, in response to request
+ * @return this
+ */
+ public DataTransferResponse withData(@Nullable Object data) {
+ setData(data);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ DataTransferResponse that = (DataTransferResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo)
+ && Objects.equals(data, that.data);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo, data);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("data", data)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/DeleteCertificateRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/DeleteCertificateRequest.java
new file mode 100644
index 000000000..957085fb0
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/DeleteCertificateRequest.java
@@ -0,0 +1,166 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CertificateHashData;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * DeleteCertificateRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class DeleteCertificateRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** certificateHashData */
+ private CertificateHashData certificateHashData;
+
+ /**
+ * Constructor for the DeleteCertificateRequest class
+ *
+ * @param certificateHashData certificateHashData
+ */
+ public DeleteCertificateRequest(CertificateHashData certificateHashData) {
+ setCertificateHashData(certificateHashData);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public DeleteCertificateRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets certificateHashData
+ *
+ * @return certificateHashData
+ */
+ public CertificateHashData getCertificateHashData() {
+ return certificateHashData;
+ }
+
+ /**
+ * Sets certificateHashData
+ *
+ * @param certificateHashData certificateHashData
+ */
+ public void setCertificateHashData(CertificateHashData certificateHashData) {
+ if (!isValidCertificateHashData(certificateHashData)) {
+ throw new PropertyConstraintException(certificateHashData, "certificateHashData is invalid");
+ }
+ this.certificateHashData = certificateHashData;
+ }
+
+ /**
+ * Returns whether the given certificateHashData is valid
+ *
+ * @param certificateHashData the certificateHashData to check the validity of
+ * @return {@code true} if certificateHashData is valid, {@code false} if not
+ */
+ private boolean isValidCertificateHashData(CertificateHashData certificateHashData) {
+ return certificateHashData != null && certificateHashData.validate();
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidCertificateHashData(certificateHashData);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ DeleteCertificateRequest that = (DeleteCertificateRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(certificateHashData, that.certificateHashData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, certificateHashData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("certificateHashData", certificateHashData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/DeleteCertificateResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/DeleteCertificateResponse.java
new file mode 100644
index 000000000..64e357d79
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/DeleteCertificateResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.DeleteCertificateStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * DeleteCertificateResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class DeleteCertificateResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Charging Station indicates if it can process the request. */
+ private DeleteCertificateStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the DeleteCertificateResponse class
+ *
+ * @param status Charging Station indicates if it can process the request.
+ */
+ public DeleteCertificateResponse(DeleteCertificateStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public DeleteCertificateResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets charging Station indicates if it can process the request.
+ *
+ * @return Charging Station indicates if it can process the request
+ */
+ public DeleteCertificateStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets charging Station indicates if it can process the request.
+ *
+ * @param status Charging Station indicates if it can process the request
+ */
+ public void setStatus(DeleteCertificateStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(DeleteCertificateStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public DeleteCertificateResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ DeleteCertificateResponse that = (DeleteCertificateResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/FirmwareStatusNotificationRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/FirmwareStatusNotificationRequest.java
new file mode 100644
index 000000000..236285da6
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/FirmwareStatusNotificationRequest.java
@@ -0,0 +1,214 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.FirmwareStatusEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * FirmwareStatusNotificationRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class FirmwareStatusNotificationRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The progress status of the firmware installation. */
+ private FirmwareStatusEnum status;
+
+ /**
+ * The request id that was provided in the UpdateFirmwareRequest that started this firmware
+ * update. This field is mandatory, unless the message was triggered by a TriggerMessageRequest
+ * AND there is no firmware update ongoing.
+ */
+ @Nullable private Integer requestId;
+
+ /**
+ * Constructor for the FirmwareStatusNotificationRequest class
+ *
+ * @param status The progress status of the firmware installation.
+ */
+ public FirmwareStatusNotificationRequest(FirmwareStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public FirmwareStatusNotificationRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the progress status of the firmware installation.
+ *
+ * @return The progress status of the firmware installation
+ */
+ public FirmwareStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the progress status of the firmware installation.
+ *
+ * @param status The progress status of the firmware installation
+ */
+ public void setStatus(FirmwareStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(FirmwareStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets the request id that was provided in the UpdateFirmwareRequest that started this firmware
+ * update. This field is mandatory, unless the message was triggered by a TriggerMessageRequest
+ * AND there is no firmware update ongoing.
+ *
+ * @return The request id that was provided in the UpdateFirmwareRequest that started this
+ * firmware update
+ */
+ @Nullable
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the request id that was provided in the UpdateFirmwareRequest that started this firmware
+ * update. This field is mandatory, unless the message was triggered by a TriggerMessageRequest
+ * AND there is no firmware update ongoing.
+ *
+ * @param requestId The request id that was provided in the UpdateFirmwareRequest that started
+ * this firmware update
+ */
+ public void setRequestId(@Nullable Integer requestId) {
+ this.requestId = requestId;
+ }
+
+ /**
+ * Adds the request id that was provided in the UpdateFirmwareRequest that started this firmware
+ * update. This field is mandatory, unless the message was triggered by a TriggerMessageRequest
+ * AND there is no firmware update ongoing.
+ *
+ * @param requestId The request id that was provided in the UpdateFirmwareRequest that started
+ * this firmware update
+ * @return this
+ */
+ public FirmwareStatusNotificationRequest withRequestId(@Nullable Integer requestId) {
+ setRequestId(requestId);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ FirmwareStatusNotificationRequest that = (FirmwareStatusNotificationRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(requestId, that.requestId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, requestId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("requestId", requestId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/FirmwareStatusNotificationResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/FirmwareStatusNotificationResponse.java
new file mode 100644
index 000000000..91867cbbc
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/FirmwareStatusNotificationResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * FirmwareStatusNotificationResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class FirmwareStatusNotificationResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the FirmwareStatusNotificationResponse class */
+ public FirmwareStatusNotificationResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public FirmwareStatusNotificationResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ FirmwareStatusNotificationResponse that = (FirmwareStatusNotificationResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/Get15118EVCertificateRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/Get15118EVCertificateRequest.java
new file mode 100644
index 000000000..10e0e9c25
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/Get15118EVCertificateRequest.java
@@ -0,0 +1,254 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CertificateActionEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Get15118EVCertificateRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class Get15118EVCertificateRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Schema version currently used for the 15118 session between EV and Charging Station. Needed for
+ * parsing of the EXI stream by the CSMS.
+ */
+ private String iso15118SchemaVersion;
+
+ /** Whether certificate needs to be installed or updated. */
+ private CertificateActionEnum action;
+
+ /** Raw CertificateInstallationReq request from EV, Base64 encoded. */
+ private String exiRequest;
+
+ /**
+ * Constructor for the Get15118EVCertificateRequest class
+ *
+ * @param iso15118SchemaVersion Schema version currently used for the 15118 session between EV and
+ * Charging Station. Needed for parsing of the EXI stream by the CSMS.
+ * @param action Whether certificate needs to be installed or updated.
+ * @param exiRequest Raw CertificateInstallationReq request from EV, Base64 encoded.
+ */
+ public Get15118EVCertificateRequest(
+ String iso15118SchemaVersion, CertificateActionEnum action, String exiRequest) {
+ setIso15118SchemaVersion(iso15118SchemaVersion);
+ setAction(action);
+ setExiRequest(exiRequest);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public Get15118EVCertificateRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets schema version currently used for the 15118 session between EV and Charging Station.
+ * Needed for parsing of the EXI stream by the CSMS.
+ *
+ * @return Schema version currently used for the 15118 session between EV and Charging Station
+ */
+ public String getIso15118SchemaVersion() {
+ return iso15118SchemaVersion;
+ }
+
+ /**
+ * Sets schema version currently used for the 15118 session between EV and Charging Station.
+ * Needed for parsing of the EXI stream by the CSMS.
+ *
+ * @param iso15118SchemaVersion Schema version currently used for the 15118 session between EV and
+ * Charging Station
+ */
+ public void setIso15118SchemaVersion(String iso15118SchemaVersion) {
+ if (!isValidIso15118SchemaVersion(iso15118SchemaVersion)) {
+ throw new PropertyConstraintException(
+ iso15118SchemaVersion, "iso15118SchemaVersion is invalid");
+ }
+ this.iso15118SchemaVersion = iso15118SchemaVersion;
+ }
+
+ /**
+ * Returns whether the given iso15118SchemaVersion is valid
+ *
+ * @param iso15118SchemaVersion the iso15118SchemaVersion to check the validity of
+ * @return {@code true} if iso15118SchemaVersion is valid, {@code false} if not
+ */
+ private boolean isValidIso15118SchemaVersion(String iso15118SchemaVersion) {
+ return iso15118SchemaVersion != null && iso15118SchemaVersion.length() <= 50;
+ }
+
+ /**
+ * Gets whether certificate needs to be installed or updated.
+ *
+ * @return Whether certificate needs to be installed or updated
+ */
+ public CertificateActionEnum getAction() {
+ return action;
+ }
+
+ /**
+ * Sets whether certificate needs to be installed or updated.
+ *
+ * @param action Whether certificate needs to be installed or updated
+ */
+ public void setAction(CertificateActionEnum action) {
+ if (!isValidAction(action)) {
+ throw new PropertyConstraintException(action, "action is invalid");
+ }
+ this.action = action;
+ }
+
+ /**
+ * Returns whether the given action is valid
+ *
+ * @param action the action to check the validity of
+ * @return {@code true} if action is valid, {@code false} if not
+ */
+ private boolean isValidAction(CertificateActionEnum action) {
+ return action != null;
+ }
+
+ /**
+ * Gets raw CertificateInstallationReq request from EV, Base64 encoded.
+ *
+ * @return Raw CertificateInstallationReq request from EV, Base64 encoded
+ */
+ public String getExiRequest() {
+ return exiRequest;
+ }
+
+ /**
+ * Sets raw CertificateInstallationReq request from EV, Base64 encoded.
+ *
+ * @param exiRequest Raw CertificateInstallationReq request from EV, Base64 encoded
+ */
+ public void setExiRequest(String exiRequest) {
+ if (!isValidExiRequest(exiRequest)) {
+ throw new PropertyConstraintException(exiRequest, "exiRequest is invalid");
+ }
+ this.exiRequest = exiRequest;
+ }
+
+ /**
+ * Returns whether the given exiRequest is valid
+ *
+ * @param exiRequest the exiRequest to check the validity of
+ * @return {@code true} if exiRequest is valid, {@code false} if not
+ */
+ private boolean isValidExiRequest(String exiRequest) {
+ return exiRequest != null && exiRequest.length() <= 5600;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidIso15118SchemaVersion(iso15118SchemaVersion)
+ && isValidAction(action)
+ && isValidExiRequest(exiRequest);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Get15118EVCertificateRequest that = (Get15118EVCertificateRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(iso15118SchemaVersion, that.iso15118SchemaVersion)
+ && Objects.equals(action, that.action)
+ && Objects.equals(exiRequest, that.exiRequest);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, iso15118SchemaVersion, action, exiRequest);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("iso15118SchemaVersion", iso15118SchemaVersion)
+ .add("action", action)
+ .add("exiRequest", exiRequest)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/Get15118EVCertificateResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/Get15118EVCertificateResponse.java
new file mode 100644
index 000000000..432334ab3
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/Get15118EVCertificateResponse.java
@@ -0,0 +1,251 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.Iso15118EVCertificateStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Get15118EVCertificateResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class Get15118EVCertificateResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the message was processed properly. */
+ private Iso15118EVCertificateStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /** Raw CertificateInstallationRes response for the EV, Base64 encoded. */
+ private String exiResponse;
+
+ /**
+ * Constructor for the Get15118EVCertificateResponse class
+ *
+ * @param status Whether the message was processed properly.
+ * @param exiResponse Raw CertificateInstallationRes response for the EV, Base64 encoded.
+ */
+ public Get15118EVCertificateResponse(Iso15118EVCertificateStatusEnum status, String exiResponse) {
+ setStatus(status);
+ setExiResponse(exiResponse);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public Get15118EVCertificateResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the message was processed properly.
+ *
+ * @return Whether the message was processed properly
+ */
+ public Iso15118EVCertificateStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the message was processed properly.
+ *
+ * @param status Whether the message was processed properly
+ */
+ public void setStatus(Iso15118EVCertificateStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(Iso15118EVCertificateStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public Get15118EVCertificateResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ /**
+ * Gets raw CertificateInstallationRes response for the EV, Base64 encoded.
+ *
+ * @return Raw CertificateInstallationRes response for the EV, Base64 encoded
+ */
+ public String getExiResponse() {
+ return exiResponse;
+ }
+
+ /**
+ * Sets raw CertificateInstallationRes response for the EV, Base64 encoded.
+ *
+ * @param exiResponse Raw CertificateInstallationRes response for the EV, Base64 encoded
+ */
+ public void setExiResponse(String exiResponse) {
+ if (!isValidExiResponse(exiResponse)) {
+ throw new PropertyConstraintException(exiResponse, "exiResponse is invalid");
+ }
+ this.exiResponse = exiResponse;
+ }
+
+ /**
+ * Returns whether the given exiResponse is valid
+ *
+ * @param exiResponse the exiResponse to check the validity of
+ * @return {@code true} if exiResponse is valid, {@code false} if not
+ */
+ private boolean isValidExiResponse(String exiResponse) {
+ return exiResponse != null && exiResponse.length() <= 5600;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidStatus(status)
+ && isValidStatusInfo(statusInfo)
+ && isValidExiResponse(exiResponse);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Get15118EVCertificateResponse that = (Get15118EVCertificateResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo)
+ && Objects.equals(exiResponse, that.exiResponse);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo, exiResponse);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("exiResponse", exiResponse)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetBaseReportRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetBaseReportRequest.java
new file mode 100644
index 000000000..9437c79ef
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetBaseReportRequest.java
@@ -0,0 +1,206 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.ReportBaseEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetBaseReportRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetBaseReportRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The Id of the request. */
+ private Integer requestId;
+
+ /** The report base. */
+ private ReportBaseEnum reportBase;
+
+ /**
+ * Constructor for the GetBaseReportRequest class
+ *
+ * @param requestId The Id of the request.
+ * @param reportBase The report base.
+ */
+ public GetBaseReportRequest(Integer requestId, ReportBaseEnum reportBase) {
+ setRequestId(requestId);
+ setReportBase(reportBase);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetBaseReportRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the Id of the request.
+ *
+ * @return The Id of the request
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the Id of the request.
+ *
+ * @param requestId The Id of the request
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets the report base.
+ *
+ * @return The report base
+ */
+ public ReportBaseEnum getReportBase() {
+ return reportBase;
+ }
+
+ /**
+ * Sets the report base.
+ *
+ * @param reportBase The report base
+ */
+ public void setReportBase(ReportBaseEnum reportBase) {
+ if (!isValidReportBase(reportBase)) {
+ throw new PropertyConstraintException(reportBase, "reportBase is invalid");
+ }
+ this.reportBase = reportBase;
+ }
+
+ /**
+ * Returns whether the given reportBase is valid
+ *
+ * @param reportBase the reportBase to check the validity of
+ * @return {@code true} if reportBase is valid, {@code false} if not
+ */
+ private boolean isValidReportBase(ReportBaseEnum reportBase) {
+ return reportBase != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidRequestId(requestId)
+ && isValidReportBase(reportBase);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetBaseReportRequest that = (GetBaseReportRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(requestId, that.requestId)
+ && Objects.equals(reportBase, that.reportBase);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, requestId, reportBase);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("requestId", requestId)
+ .add("reportBase", reportBase)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetBaseReportResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetBaseReportResponse.java
new file mode 100644
index 000000000..621b590cf
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetBaseReportResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GenericDeviceModelStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetBaseReportResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetBaseReportResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the Charging Station is able to accept this request. */
+ private GenericDeviceModelStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the GetBaseReportResponse class
+ *
+ * @param status Whether the Charging Station is able to accept this request.
+ */
+ public GetBaseReportResponse(GenericDeviceModelStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetBaseReportResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Charging Station is able to accept this request.
+ *
+ * @return Whether the Charging Station is able to accept this request
+ */
+ public GenericDeviceModelStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station is able to accept this request.
+ *
+ * @param status Whether the Charging Station is able to accept this request
+ */
+ public void setStatus(GenericDeviceModelStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GenericDeviceModelStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public GetBaseReportResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetBaseReportResponse that = (GetBaseReportResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetCertificateStatusRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetCertificateStatusRequest.java
new file mode 100644
index 000000000..4bec69877
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetCertificateStatusRequest.java
@@ -0,0 +1,166 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.OCSPRequestData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetCertificateStatusRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetCertificateStatusRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** ocspRequestData */
+ private OCSPRequestData ocspRequestData;
+
+ /**
+ * Constructor for the GetCertificateStatusRequest class
+ *
+ * @param ocspRequestData ocspRequestData
+ */
+ public GetCertificateStatusRequest(OCSPRequestData ocspRequestData) {
+ setOcspRequestData(ocspRequestData);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetCertificateStatusRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets ocspRequestData
+ *
+ * @return ocspRequestData
+ */
+ public OCSPRequestData getOcspRequestData() {
+ return ocspRequestData;
+ }
+
+ /**
+ * Sets ocspRequestData
+ *
+ * @param ocspRequestData ocspRequestData
+ */
+ public void setOcspRequestData(OCSPRequestData ocspRequestData) {
+ if (!isValidOcspRequestData(ocspRequestData)) {
+ throw new PropertyConstraintException(ocspRequestData, "ocspRequestData is invalid");
+ }
+ this.ocspRequestData = ocspRequestData;
+ }
+
+ /**
+ * Returns whether the given ocspRequestData is valid
+ *
+ * @param ocspRequestData the ocspRequestData to check the validity of
+ * @return {@code true} if ocspRequestData is valid, {@code false} if not
+ */
+ private boolean isValidOcspRequestData(OCSPRequestData ocspRequestData) {
+ return ocspRequestData != null && ocspRequestData.validate();
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidOcspRequestData(ocspRequestData);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetCertificateStatusRequest that = (GetCertificateStatusRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(ocspRequestData, that.ocspRequestData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, ocspRequestData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("ocspRequestData", ocspRequestData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetCertificateStatusResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetCertificateStatusResponse.java
new file mode 100644
index 000000000..6a645ed73
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetCertificateStatusResponse.java
@@ -0,0 +1,267 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GetCertificateStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetCertificateStatusResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetCertificateStatusResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the charging station was able to retrieve the OCSP certificate status. */
+ private GetCertificateStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * OCSPResponse class as defined in IETF RFC 6960. DER encoded (as defined in IETF RFC 6960), and
+ * then base64 encoded. MAY only be omitted when status is not Accepted.
+ */
+ @Nullable private String ocspResult;
+
+ /**
+ * Constructor for the GetCertificateStatusResponse class
+ *
+ * @param status Whether the charging station was able to retrieve the OCSP certificate status.
+ */
+ public GetCertificateStatusResponse(GetCertificateStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetCertificateStatusResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the charging station was able to retrieve the OCSP certificate status.
+ *
+ * @return Whether the charging station was able to retrieve the OCSP certificate status
+ */
+ public GetCertificateStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the charging station was able to retrieve the OCSP certificate status.
+ *
+ * @param status Whether the charging station was able to retrieve the OCSP certificate status
+ */
+ public void setStatus(GetCertificateStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GetCertificateStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public GetCertificateStatusResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ /**
+ * Gets OCSPResponse class as defined in IETF RFC 6960. DER encoded (as defined in IETF RFC 6960),
+ * and then base64 encoded. MAY only be omitted when status is not Accepted.
+ *
+ * @return OCSPResponse class as defined in IETF RFC 6960
+ */
+ @Nullable
+ public String getOcspResult() {
+ return ocspResult;
+ }
+
+ /**
+ * Sets OCSPResponse class as defined in IETF RFC 6960. DER encoded (as defined in IETF RFC 6960),
+ * and then base64 encoded. MAY only be omitted when status is not Accepted.
+ *
+ * @param ocspResult OCSPResponse class as defined in IETF RFC 6960
+ */
+ public void setOcspResult(@Nullable String ocspResult) {
+ if (!isValidOcspResult(ocspResult)) {
+ throw new PropertyConstraintException(ocspResult, "ocspResult is invalid");
+ }
+ this.ocspResult = ocspResult;
+ }
+
+ /**
+ * Returns whether the given ocspResult is valid
+ *
+ * @param ocspResult the ocspResult to check the validity of
+ * @return {@code true} if ocspResult is valid, {@code false} if not
+ */
+ private boolean isValidOcspResult(@Nullable String ocspResult) {
+ return ocspResult == null || ocspResult.length() <= 5500;
+ }
+
+ /**
+ * Adds OCSPResponse class as defined in IETF RFC 6960. DER encoded (as defined in IETF RFC 6960),
+ * and then base64 encoded. MAY only be omitted when status is not Accepted.
+ *
+ * @param ocspResult OCSPResponse class as defined in IETF RFC 6960
+ * @return this
+ */
+ public GetCertificateStatusResponse withOcspResult(@Nullable String ocspResult) {
+ setOcspResult(ocspResult);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidStatus(status)
+ && isValidStatusInfo(statusInfo)
+ && isValidOcspResult(ocspResult);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetCertificateStatusResponse that = (GetCertificateStatusResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo)
+ && Objects.equals(ocspResult, that.ocspResult);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo, ocspResult);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("ocspResult", ocspResult)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetChargingProfilesRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetChargingProfilesRequest.java
new file mode 100644
index 000000000..796082561
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetChargingProfilesRequest.java
@@ -0,0 +1,269 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ChargingProfileCriterion;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetChargingProfilesRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetChargingProfilesRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Reference identification that is to be used by the Charging Station in the
+ * ReportChargingProfilesRequest when provided.
+ */
+ private Integer requestId;
+
+ /**
+ * For which EVSE installed charging profiles SHALL be reported. If 0, only charging profiles
+ * installed on the Charging Station itself (the grid connection) SHALL be reported. If omitted,
+ * all installed charging profiles SHALL be reported.
+ */
+ @Nullable private Integer evseId;
+
+ /**
+ * Charging Profile
+ *
+ * A ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ */
+ private ChargingProfileCriterion chargingProfile;
+
+ /**
+ * Constructor for the GetChargingProfilesRequest class
+ *
+ * @param requestId Reference identification that is to be used by the Charging Station in the
+ * ReportChargingProfilesRequest when provided.
+ * @param chargingProfile A ChargingProfile consists of ChargingSchedule, describing the amount of
+ * power or current that can be delivered per time interval.
+ */
+ public GetChargingProfilesRequest(Integer requestId, ChargingProfileCriterion chargingProfile) {
+ setRequestId(requestId);
+ setChargingProfile(chargingProfile);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetChargingProfilesRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets reference identification that is to be used by the Charging Station in the
+ * ReportChargingProfilesRequest when provided.
+ *
+ * @return Reference identification that is to be used by the Charging Station in the
+ * ReportChargingProfilesRequest when provided
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets reference identification that is to be used by the Charging Station in the
+ * ReportChargingProfilesRequest when provided.
+ *
+ * @param requestId Reference identification that is to be used by the Charging Station in the
+ * ReportChargingProfilesRequest when provided
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets for which EVSE installed charging profiles SHALL be reported. If 0, only charging profiles
+ * installed on the Charging Station itself (the grid connection) SHALL be reported. If omitted,
+ * all installed charging profiles SHALL be reported.
+ *
+ * @return For which EVSE installed charging profiles SHALL be reported
+ */
+ @Nullable
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets for which EVSE installed charging profiles SHALL be reported. If 0, only charging profiles
+ * installed on the Charging Station itself (the grid connection) SHALL be reported. If omitted,
+ * all installed charging profiles SHALL be reported.
+ *
+ * @param evseId For which EVSE installed charging profiles SHALL be reported
+ */
+ public void setEvseId(@Nullable Integer evseId) {
+ this.evseId = evseId;
+ }
+
+ /**
+ * Adds for which EVSE installed charging profiles SHALL be reported. If 0, only charging profiles
+ * installed on the Charging Station itself (the grid connection) SHALL be reported. If omitted,
+ * all installed charging profiles SHALL be reported.
+ *
+ * @param evseId For which EVSE installed charging profiles SHALL be reported
+ * @return this
+ */
+ public GetChargingProfilesRequest withEvseId(@Nullable Integer evseId) {
+ setEvseId(evseId);
+ return this;
+ }
+
+ /**
+ * Gets a ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ *
+ * @return A ChargingProfile consists of ChargingSchedule, describing the amount of power or
+ * current that can be delivered per time interval
+ */
+ public ChargingProfileCriterion getChargingProfile() {
+ return chargingProfile;
+ }
+
+ /**
+ * Sets a ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ *
+ * @param chargingProfile A ChargingProfile consists of ChargingSchedule, describing the amount of
+ * power or current that can be delivered per time interval
+ */
+ public void setChargingProfile(ChargingProfileCriterion chargingProfile) {
+ if (!isValidChargingProfile(chargingProfile)) {
+ throw new PropertyConstraintException(chargingProfile, "chargingProfile is invalid");
+ }
+ this.chargingProfile = chargingProfile;
+ }
+
+ /**
+ * Returns whether the given chargingProfile is valid
+ *
+ * @param chargingProfile the chargingProfile to check the validity of
+ * @return {@code true} if chargingProfile is valid, {@code false} if not
+ */
+ private boolean isValidChargingProfile(ChargingProfileCriterion chargingProfile) {
+ return chargingProfile != null && chargingProfile.validate();
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidRequestId(requestId)
+ && isValidChargingProfile(chargingProfile);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetChargingProfilesRequest that = (GetChargingProfilesRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(requestId, that.requestId)
+ && Objects.equals(evseId, that.evseId)
+ && Objects.equals(chargingProfile, that.chargingProfile);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, requestId, evseId, chargingProfile);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("requestId", requestId)
+ .add("evseId", evseId)
+ .add("chargingProfile", chargingProfile)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetChargingProfilesResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetChargingProfilesResponse.java
new file mode 100644
index 000000000..89f10610f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetChargingProfilesResponse.java
@@ -0,0 +1,218 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GetChargingProfileStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetChargingProfilesResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetChargingProfilesResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Whether the Charging Station is able to process this request and will send
+ * ReportChargingProfilesRequest messages.
+ */
+ private GetChargingProfileStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the GetChargingProfilesResponse class
+ *
+ * @param status Whether the Charging Station is able to process this request and will send
+ * ReportChargingProfilesRequest messages.
+ */
+ public GetChargingProfilesResponse(GetChargingProfileStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetChargingProfilesResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Charging Station is able to process this request and will send
+ * ReportChargingProfilesRequest messages.
+ *
+ * @return Whether the Charging Station is able to process this request and will send
+ * ReportChargingProfilesRequest messages
+ */
+ public GetChargingProfileStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station is able to process this request and will send
+ * ReportChargingProfilesRequest messages.
+ *
+ * @param status Whether the Charging Station is able to process this request and will send
+ * ReportChargingProfilesRequest messages
+ */
+ public void setStatus(GetChargingProfileStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GetChargingProfileStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public GetChargingProfilesResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetChargingProfilesResponse that = (GetChargingProfilesResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetCompositeScheduleRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetCompositeScheduleRequest.java
new file mode 100644
index 000000000..300e4f68a
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetCompositeScheduleRequest.java
@@ -0,0 +1,246 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ChargingRateUnitEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetCompositeScheduleRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetCompositeScheduleRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Length of the requested schedule in seconds. */
+ private Integer duration;
+
+ /** Can be used to force a power or current profile. */
+ @Nullable private ChargingRateUnitEnum chargingRateUnit;
+
+ /**
+ * The ID of the EVSE for which the schedule is requested. When evseid=0, the Charging Station
+ * will calculate the expected consumption for the grid connection.
+ */
+ private Integer evseId;
+
+ /**
+ * Constructor for the GetCompositeScheduleRequest class
+ *
+ * @param duration Length of the requested schedule in seconds.
+ * @param evseId The ID of the EVSE for which the schedule is requested. When evseid=0, the
+ * Charging Station will calculate the expected consumption for the grid connection.
+ */
+ public GetCompositeScheduleRequest(Integer duration, Integer evseId) {
+ setDuration(duration);
+ setEvseId(evseId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetCompositeScheduleRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets length of the requested schedule in seconds.
+ *
+ * @return Length of the requested schedule in seconds
+ */
+ public Integer getDuration() {
+ return duration;
+ }
+
+ /**
+ * Sets length of the requested schedule in seconds.
+ *
+ * @param duration Length of the requested schedule in seconds
+ */
+ public void setDuration(Integer duration) {
+ if (!isValidDuration(duration)) {
+ throw new PropertyConstraintException(duration, "duration is invalid");
+ }
+ this.duration = duration;
+ }
+
+ /**
+ * Returns whether the given duration is valid
+ *
+ * @param duration the duration to check the validity of
+ * @return {@code true} if duration is valid, {@code false} if not
+ */
+ private boolean isValidDuration(Integer duration) {
+ return duration != null;
+ }
+
+ /**
+ * Gets can be used to force a power or current profile.
+ *
+ * @return Can be used to force a power or current profile
+ */
+ @Nullable
+ public ChargingRateUnitEnum getChargingRateUnit() {
+ return chargingRateUnit;
+ }
+
+ /**
+ * Sets can be used to force a power or current profile.
+ *
+ * @param chargingRateUnit Can be used to force a power or current profile
+ */
+ public void setChargingRateUnit(@Nullable ChargingRateUnitEnum chargingRateUnit) {
+ this.chargingRateUnit = chargingRateUnit;
+ }
+
+ /**
+ * Adds can be used to force a power or current profile.
+ *
+ * @param chargingRateUnit Can be used to force a power or current profile
+ * @return this
+ */
+ public GetCompositeScheduleRequest withChargingRateUnit(
+ @Nullable ChargingRateUnitEnum chargingRateUnit) {
+ setChargingRateUnit(chargingRateUnit);
+ return this;
+ }
+
+ /**
+ * Gets the ID of the EVSE for which the schedule is requested. When evseid=0, the Charging
+ * Station will calculate the expected consumption for the grid connection.
+ *
+ * @return The ID of the EVSE for which the schedule is requested
+ */
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets the ID of the EVSE for which the schedule is requested. When evseid=0, the Charging
+ * Station will calculate the expected consumption for the grid connection.
+ *
+ * @param evseId The ID of the EVSE for which the schedule is requested
+ */
+ public void setEvseId(Integer evseId) {
+ if (!isValidEvseId(evseId)) {
+ throw new PropertyConstraintException(evseId, "evseId is invalid");
+ }
+ this.evseId = evseId;
+ }
+
+ /**
+ * Returns whether the given evseId is valid
+ *
+ * @param evseId the evseId to check the validity of
+ * @return {@code true} if evseId is valid, {@code false} if not
+ */
+ private boolean isValidEvseId(Integer evseId) {
+ return evseId != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidDuration(duration) && isValidEvseId(evseId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetCompositeScheduleRequest that = (GetCompositeScheduleRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(duration, that.duration)
+ && Objects.equals(chargingRateUnit, that.chargingRateUnit)
+ && Objects.equals(evseId, that.evseId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, duration, chargingRateUnit, evseId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("duration", duration)
+ .add("chargingRateUnit", chargingRateUnit)
+ .add("evseId", evseId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetCompositeScheduleResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetCompositeScheduleResponse.java
new file mode 100644
index 000000000..02278ce6b
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetCompositeScheduleResponse.java
@@ -0,0 +1,262 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CompositeSchedule;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GenericStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetCompositeScheduleResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetCompositeScheduleResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The Charging Station will indicate if it was able to process the request */
+ private GenericStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /** Composite Schedule */
+ @Nullable private CompositeSchedule schedule;
+
+ /**
+ * Constructor for the GetCompositeScheduleResponse class
+ *
+ * @param status The Charging Station will indicate if it was able to process the request
+ */
+ public GetCompositeScheduleResponse(GenericStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetCompositeScheduleResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the Charging Station will indicate if it was able to process the request
+ *
+ * @return The Charging Station will indicate if it was able to process the request
+ */
+ public GenericStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the Charging Station will indicate if it was able to process the request
+ *
+ * @param status The Charging Station will indicate if it was able to process the request
+ */
+ public void setStatus(GenericStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GenericStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public GetCompositeScheduleResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ /**
+ * Gets composite Schedule
+ *
+ * @return Composite Schedule
+ */
+ @Nullable
+ public CompositeSchedule getSchedule() {
+ return schedule;
+ }
+
+ /**
+ * Sets composite Schedule
+ *
+ * @param schedule Composite Schedule
+ */
+ public void setSchedule(@Nullable CompositeSchedule schedule) {
+ if (!isValidSchedule(schedule)) {
+ throw new PropertyConstraintException(schedule, "schedule is invalid");
+ }
+ this.schedule = schedule;
+ }
+
+ /**
+ * Returns whether the given schedule is valid
+ *
+ * @param schedule the schedule to check the validity of
+ * @return {@code true} if schedule is valid, {@code false} if not
+ */
+ private boolean isValidSchedule(@Nullable CompositeSchedule schedule) {
+ return schedule == null || schedule.validate();
+ }
+
+ /**
+ * Adds composite Schedule
+ *
+ * @param schedule Composite Schedule
+ * @return this
+ */
+ public GetCompositeScheduleResponse withSchedule(@Nullable CompositeSchedule schedule) {
+ setSchedule(schedule);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidStatus(status)
+ && isValidStatusInfo(statusInfo)
+ && isValidSchedule(schedule);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetCompositeScheduleResponse that = (GetCompositeScheduleResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo)
+ && Objects.equals(schedule, that.schedule);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo, schedule);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("schedule", schedule)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetDisplayMessagesRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetDisplayMessagesRequest.java
new file mode 100644
index 000000000..ff3fc98f6
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetDisplayMessagesRequest.java
@@ -0,0 +1,303 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.MessagePriorityEnum;
+import eu.chargetime.ocpp.v201.model.types.MessageStateEnum;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetDisplayMessagesRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetDisplayMessagesRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * If provided the Charging Station shall return Display Messages of the given ids. This field
+ * SHALL NOT contain more ids than set in NumberOfDisplayMessages.maxLimit
+ */
+ @Nullable private Integer[] id;
+
+ /** The Id of this request. */
+ private Integer requestId;
+
+ /**
+ * If provided the Charging Station shall return Display Messages with the given priority only.
+ */
+ @Nullable private MessagePriorityEnum priority;
+
+ /** If provided the Charging Station shall return Display Messages with the given state only. */
+ @Nullable private MessageStateEnum state;
+
+ /**
+ * Constructor for the GetDisplayMessagesRequest class
+ *
+ * @param requestId The Id of this request.
+ */
+ public GetDisplayMessagesRequest(Integer requestId) {
+ setRequestId(requestId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetDisplayMessagesRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets if provided the Charging Station shall return Display Messages of the given ids. This
+ * field SHALL NOT contain more ids than set in NumberOfDisplayMessages.maxLimit
+ *
+ * @return If provided the Charging Station shall return Display Messages of the given ids
+ */
+ @Nullable
+ public Integer[] getId() {
+ return id;
+ }
+
+ /**
+ * Sets if provided the Charging Station shall return Display Messages of the given ids. This
+ * field SHALL NOT contain more ids than set in NumberOfDisplayMessages.maxLimit
+ *
+ * @param id If provided the Charging Station shall return Display Messages of the given ids
+ */
+ public void setId(@Nullable Integer[] id) {
+ if (!isValidId(id)) {
+ throw new PropertyConstraintException(id, "id is invalid");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Returns whether the given id is valid
+ *
+ * @param id the id to check the validity of
+ * @return {@code true} if id is valid, {@code false} if not
+ */
+ private boolean isValidId(@Nullable Integer[] id) {
+ return id == null || (id.length >= 1);
+ }
+
+ /**
+ * Adds if provided the Charging Station shall return Display Messages of the given ids. This
+ * field SHALL NOT contain more ids than set in NumberOfDisplayMessages.maxLimit
+ *
+ * @param id If provided the Charging Station shall return Display Messages of the given ids
+ * @return this
+ */
+ public GetDisplayMessagesRequest withId(@Nullable Integer[] id) {
+ setId(id);
+ return this;
+ }
+
+ /**
+ * Gets the Id of this request.
+ *
+ * @return The Id of this request
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the Id of this request.
+ *
+ * @param requestId The Id of this request
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets if provided the Charging Station shall return Display Messages with the given priority
+ * only.
+ *
+ * @return If provided the Charging Station shall return Display Messages with the given priority
+ * only
+ */
+ @Nullable
+ public MessagePriorityEnum getPriority() {
+ return priority;
+ }
+
+ /**
+ * Sets if provided the Charging Station shall return Display Messages with the given priority
+ * only.
+ *
+ * @param priority If provided the Charging Station shall return Display Messages with the given
+ * priority only
+ */
+ public void setPriority(@Nullable MessagePriorityEnum priority) {
+ this.priority = priority;
+ }
+
+ /**
+ * Adds if provided the Charging Station shall return Display Messages with the given priority
+ * only.
+ *
+ * @param priority If provided the Charging Station shall return Display Messages with the given
+ * priority only
+ * @return this
+ */
+ public GetDisplayMessagesRequest withPriority(@Nullable MessagePriorityEnum priority) {
+ setPriority(priority);
+ return this;
+ }
+
+ /**
+ * Gets if provided the Charging Station shall return Display Messages with the given state only.
+ *
+ * @return If provided the Charging Station shall return Display Messages with the given state
+ * only
+ */
+ @Nullable
+ public MessageStateEnum getState() {
+ return state;
+ }
+
+ /**
+ * Sets if provided the Charging Station shall return Display Messages with the given state only.
+ *
+ * @param state If provided the Charging Station shall return Display Messages with the given
+ * state only
+ */
+ public void setState(@Nullable MessageStateEnum state) {
+ this.state = state;
+ }
+
+ /**
+ * Adds if provided the Charging Station shall return Display Messages with the given state only.
+ *
+ * @param state If provided the Charging Station shall return Display Messages with the given
+ * state only
+ * @return this
+ */
+ public GetDisplayMessagesRequest withState(@Nullable MessageStateEnum state) {
+ setState(state);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidId(id) && isValidRequestId(requestId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetDisplayMessagesRequest that = (GetDisplayMessagesRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(id, that.id)
+ && Objects.equals(requestId, that.requestId)
+ && Objects.equals(priority, that.priority)
+ && Objects.equals(state, that.state);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(id), requestId, priority, state);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("id", id)
+ .add("requestId", requestId)
+ .add("priority", priority)
+ .add("state", state)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetDisplayMessagesResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetDisplayMessagesResponse.java
new file mode 100644
index 000000000..a6b8d2b31
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetDisplayMessagesResponse.java
@@ -0,0 +1,218 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GetDisplayMessagesStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetDisplayMessagesResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetDisplayMessagesResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Whether the Charging Station has Display Messages that match the request criteria in the
+ * GetDisplayMessagesRequest
+ */
+ private GetDisplayMessagesStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the GetDisplayMessagesResponse class
+ *
+ * @param status Whether the Charging Station has Display Messages that match the request criteria
+ * in the GetDisplayMessagesRequest
+ */
+ public GetDisplayMessagesResponse(GetDisplayMessagesStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetDisplayMessagesResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Charging Station has Display Messages that match the request criteria in the
+ * GetDisplayMessagesRequest
+ *
+ * @return Whether the Charging Station has Display Messages that match the request criteria in
+ * the GetDisplayMessagesRequest
+ */
+ public GetDisplayMessagesStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station has Display Messages that match the request criteria in the
+ * GetDisplayMessagesRequest
+ *
+ * @param status Whether the Charging Station has Display Messages that match the request criteria
+ * in the GetDisplayMessagesRequest
+ */
+ public void setStatus(GetDisplayMessagesStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GetDisplayMessagesStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public GetDisplayMessagesResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetDisplayMessagesResponse that = (GetDisplayMessagesResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetInstalledCertificateIdsRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetInstalledCertificateIdsRequest.java
new file mode 100644
index 000000000..c9be927ce
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetInstalledCertificateIdsRequest.java
@@ -0,0 +1,174 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GetCertificateIdUseEnum;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetInstalledCertificateIdsRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetInstalledCertificateIdsRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The type of certificates requested. When omitted, all certificate types are requested. */
+ @Nullable private GetCertificateIdUseEnum[] certificateType;
+
+ /** Constructor for the GetInstalledCertificateIdsRequest class */
+ public GetInstalledCertificateIdsRequest() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetInstalledCertificateIdsRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the type of certificates requested. When omitted, all certificate types are requested.
+ *
+ * @return The type of certificates requested
+ */
+ @Nullable
+ public GetCertificateIdUseEnum[] getCertificateType() {
+ return certificateType;
+ }
+
+ /**
+ * Sets the type of certificates requested. When omitted, all certificate types are requested.
+ *
+ * @param certificateType The type of certificates requested
+ */
+ public void setCertificateType(@Nullable GetCertificateIdUseEnum[] certificateType) {
+ if (!isValidCertificateType(certificateType)) {
+ throw new PropertyConstraintException(certificateType, "certificateType is invalid");
+ }
+ this.certificateType = certificateType;
+ }
+
+ /**
+ * Returns whether the given certificateType is valid
+ *
+ * @param certificateType the certificateType to check the validity of
+ * @return {@code true} if certificateType is valid, {@code false} if not
+ */
+ private boolean isValidCertificateType(@Nullable GetCertificateIdUseEnum[] certificateType) {
+ return certificateType == null || (certificateType.length >= 1);
+ }
+
+ /**
+ * Adds the type of certificates requested. When omitted, all certificate types are requested.
+ *
+ * @param certificateType The type of certificates requested
+ * @return this
+ */
+ public GetInstalledCertificateIdsRequest withCertificateType(
+ @Nullable GetCertificateIdUseEnum[] certificateType) {
+ setCertificateType(certificateType);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidCertificateType(certificateType);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetInstalledCertificateIdsRequest that = (GetInstalledCertificateIdsRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(certificateType, that.certificateType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(certificateType));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("certificateType", certificateType)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetInstalledCertificateIdsResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetInstalledCertificateIdsResponse.java
new file mode 100644
index 000000000..6a17d5a48
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetInstalledCertificateIdsResponse.java
@@ -0,0 +1,269 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CertificateHashDataChain;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GetInstalledCertificateStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetInstalledCertificateIdsResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetInstalledCertificateIdsResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Charging Station indicates if it can process the request. */
+ private GetInstalledCertificateStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /** certificateHashDataChain */
+ @Nullable private CertificateHashDataChain[] certificateHashDataChain;
+
+ /**
+ * Constructor for the GetInstalledCertificateIdsResponse class
+ *
+ * @param status Charging Station indicates if it can process the request.
+ */
+ public GetInstalledCertificateIdsResponse(GetInstalledCertificateStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetInstalledCertificateIdsResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets charging Station indicates if it can process the request.
+ *
+ * @return Charging Station indicates if it can process the request
+ */
+ public GetInstalledCertificateStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets charging Station indicates if it can process the request.
+ *
+ * @param status Charging Station indicates if it can process the request
+ */
+ public void setStatus(GetInstalledCertificateStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GetInstalledCertificateStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public GetInstalledCertificateIdsResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ /**
+ * Gets certificateHashDataChain
+ *
+ * @return certificateHashDataChain
+ */
+ @Nullable
+ public CertificateHashDataChain[] getCertificateHashDataChain() {
+ return certificateHashDataChain;
+ }
+
+ /**
+ * Sets certificateHashDataChain
+ *
+ * @param certificateHashDataChain certificateHashDataChain
+ */
+ public void setCertificateHashDataChain(
+ @Nullable CertificateHashDataChain[] certificateHashDataChain) {
+ if (!isValidCertificateHashDataChain(certificateHashDataChain)) {
+ throw new PropertyConstraintException(
+ certificateHashDataChain, "certificateHashDataChain is invalid");
+ }
+ this.certificateHashDataChain = certificateHashDataChain;
+ }
+
+ /**
+ * Returns whether the given certificateHashDataChain is valid
+ *
+ * @param certificateHashDataChain the certificateHashDataChain to check the validity of
+ * @return {@code true} if certificateHashDataChain is valid, {@code false} if not
+ */
+ private boolean isValidCertificateHashDataChain(
+ @Nullable CertificateHashDataChain[] certificateHashDataChain) {
+ return certificateHashDataChain == null
+ || (certificateHashDataChain.length >= 1
+ && Arrays.stream(certificateHashDataChain).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds certificateHashDataChain
+ *
+ * @param certificateHashDataChain certificateHashDataChain
+ * @return this
+ */
+ public GetInstalledCertificateIdsResponse withCertificateHashDataChain(
+ @Nullable CertificateHashDataChain[] certificateHashDataChain) {
+ setCertificateHashDataChain(certificateHashDataChain);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidStatus(status)
+ && isValidStatusInfo(statusInfo)
+ && isValidCertificateHashDataChain(certificateHashDataChain);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetInstalledCertificateIdsResponse that = (GetInstalledCertificateIdsResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo)
+ && Arrays.equals(certificateHashDataChain, that.certificateHashDataChain);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo, Arrays.hashCode(certificateHashDataChain));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("certificateHashDataChain", certificateHashDataChain)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetLocalListVersionRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetLocalListVersionRequest.java
new file mode 100644
index 000000000..63221fddd
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetLocalListVersionRequest.java
@@ -0,0 +1,123 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetLocalListVersionRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetLocalListVersionRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the GetLocalListVersionRequest class */
+ public GetLocalListVersionRequest() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetLocalListVersionRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetLocalListVersionRequest that = (GetLocalListVersionRequest) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetLocalListVersionResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetLocalListVersionResponse.java
new file mode 100644
index 000000000..93736aa14
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetLocalListVersionResponse.java
@@ -0,0 +1,162 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetLocalListVersionResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetLocalListVersionResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The current version number of the local authorization list in the Charging Station. */
+ private Integer versionNumber;
+
+ /**
+ * Constructor for the GetLocalListVersionResponse class
+ *
+ * @param versionNumber The current version number of the local authorization list in the Charging
+ * Station.
+ */
+ public GetLocalListVersionResponse(Integer versionNumber) {
+ setVersionNumber(versionNumber);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetLocalListVersionResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the current version number of the local authorization list in the Charging Station.
+ *
+ * @return The current version number of the local authorization list in the Charging Station
+ */
+ public Integer getVersionNumber() {
+ return versionNumber;
+ }
+
+ /**
+ * Sets the current version number of the local authorization list in the Charging Station.
+ *
+ * @param versionNumber The current version number of the local authorization list in the Charging
+ * Station
+ */
+ public void setVersionNumber(Integer versionNumber) {
+ if (!isValidVersionNumber(versionNumber)) {
+ throw new PropertyConstraintException(versionNumber, "versionNumber is invalid");
+ }
+ this.versionNumber = versionNumber;
+ }
+
+ /**
+ * Returns whether the given versionNumber is valid
+ *
+ * @param versionNumber the versionNumber to check the validity of
+ * @return {@code true} if versionNumber is valid, {@code false} if not
+ */
+ private boolean isValidVersionNumber(Integer versionNumber) {
+ return versionNumber != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidVersionNumber(versionNumber);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetLocalListVersionResponse that = (GetLocalListVersionResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(versionNumber, that.versionNumber);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, versionNumber);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("versionNumber", versionNumber)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetLogRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetLogRequest.java
new file mode 100644
index 000000000..61e97c2c5
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetLogRequest.java
@@ -0,0 +1,335 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.LogEnum;
+import eu.chargetime.ocpp.v201.model.types.LogParameters;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetLogRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetLogRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Log
+ *
+ * Generic class for the configuration of logging entries.
+ */
+ private LogParameters log;
+
+ /** The type of log file that the Charging Station should send. */
+ private LogEnum logType;
+
+ /** The Id of this request */
+ private Integer requestId;
+
+ /**
+ * How many times the Charging Station must try to upload the log before giving up. If this field
+ * is not present, it is left to Charging Station to decide how many times it wants to retry.
+ */
+ @Nullable private Integer retries;
+
+ /**
+ * The interval in seconds after which a retry may be attempted. If this field is not present, it
+ * is left to Charging Station to decide how long to wait between attempts.
+ */
+ @Nullable private Integer retryInterval;
+
+ /**
+ * Constructor for the GetLogRequest class
+ *
+ * @param log Generic class for the configuration of logging entries.
+ * @param logType The type of log file that the Charging Station should send.
+ * @param requestId The Id of this request
+ */
+ public GetLogRequest(LogParameters log, LogEnum logType, Integer requestId) {
+ setLog(log);
+ setLogType(logType);
+ setRequestId(requestId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetLogRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets generic class for the configuration of logging entries.
+ *
+ * @return Generic class for the configuration of logging entries
+ */
+ public LogParameters getLog() {
+ return log;
+ }
+
+ /**
+ * Sets generic class for the configuration of logging entries.
+ *
+ * @param log Generic class for the configuration of logging entries
+ */
+ public void setLog(LogParameters log) {
+ if (!isValidLog(log)) {
+ throw new PropertyConstraintException(log, "log is invalid");
+ }
+ this.log = log;
+ }
+
+ /**
+ * Returns whether the given log is valid
+ *
+ * @param log the log to check the validity of
+ * @return {@code true} if log is valid, {@code false} if not
+ */
+ private boolean isValidLog(LogParameters log) {
+ return log != null && log.validate();
+ }
+
+ /**
+ * Gets the type of log file that the Charging Station should send.
+ *
+ * @return The type of log file that the Charging Station should send
+ */
+ public LogEnum getLogType() {
+ return logType;
+ }
+
+ /**
+ * Sets the type of log file that the Charging Station should send.
+ *
+ * @param logType The type of log file that the Charging Station should send
+ */
+ public void setLogType(LogEnum logType) {
+ if (!isValidLogType(logType)) {
+ throw new PropertyConstraintException(logType, "logType is invalid");
+ }
+ this.logType = logType;
+ }
+
+ /**
+ * Returns whether the given logType is valid
+ *
+ * @param logType the logType to check the validity of
+ * @return {@code true} if logType is valid, {@code false} if not
+ */
+ private boolean isValidLogType(LogEnum logType) {
+ return logType != null;
+ }
+
+ /**
+ * Gets the Id of this request
+ *
+ * @return The Id of this request
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the Id of this request
+ *
+ * @param requestId The Id of this request
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets how many times the Charging Station must try to upload the log before giving up. If this
+ * field is not present, it is left to Charging Station to decide how many times it wants to
+ * retry.
+ *
+ * @return How many times the Charging Station must try to upload the log before giving up
+ */
+ @Nullable
+ public Integer getRetries() {
+ return retries;
+ }
+
+ /**
+ * Sets how many times the Charging Station must try to upload the log before giving up. If this
+ * field is not present, it is left to Charging Station to decide how many times it wants to
+ * retry.
+ *
+ * @param retries How many times the Charging Station must try to upload the log before giving up
+ */
+ public void setRetries(@Nullable Integer retries) {
+ this.retries = retries;
+ }
+
+ /**
+ * Adds how many times the Charging Station must try to upload the log before giving up. If this
+ * field is not present, it is left to Charging Station to decide how many times it wants to
+ * retry.
+ *
+ * @param retries How many times the Charging Station must try to upload the log before giving up
+ * @return this
+ */
+ public GetLogRequest withRetries(@Nullable Integer retries) {
+ setRetries(retries);
+ return this;
+ }
+
+ /**
+ * Gets the interval in seconds after which a retry may be attempted. If this field is not
+ * present, it is left to Charging Station to decide how long to wait between attempts.
+ *
+ * @return The interval in seconds after which a retry may be attempted
+ */
+ @Nullable
+ public Integer getRetryInterval() {
+ return retryInterval;
+ }
+
+ /**
+ * Sets the interval in seconds after which a retry may be attempted. If this field is not
+ * present, it is left to Charging Station to decide how long to wait between attempts.
+ *
+ * @param retryInterval The interval in seconds after which a retry may be attempted
+ */
+ public void setRetryInterval(@Nullable Integer retryInterval) {
+ this.retryInterval = retryInterval;
+ }
+
+ /**
+ * Adds the interval in seconds after which a retry may be attempted. If this field is not
+ * present, it is left to Charging Station to decide how long to wait between attempts.
+ *
+ * @param retryInterval The interval in seconds after which a retry may be attempted
+ * @return this
+ */
+ public GetLogRequest withRetryInterval(@Nullable Integer retryInterval) {
+ setRetryInterval(retryInterval);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidLog(log)
+ && isValidLogType(logType)
+ && isValidRequestId(requestId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetLogRequest that = (GetLogRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(log, that.log)
+ && Objects.equals(logType, that.logType)
+ && Objects.equals(requestId, that.requestId)
+ && Objects.equals(retries, that.retries)
+ && Objects.equals(retryInterval, that.retryInterval);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, log, logType, requestId, retries, retryInterval);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("log", log)
+ .add("logType", logType)
+ .add("requestId", requestId)
+ .add("retries", retries)
+ .add("retryInterval", retryInterval)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetLogResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetLogResponse.java
new file mode 100644
index 000000000..c66d3cd2c
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetLogResponse.java
@@ -0,0 +1,267 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.LogStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetLogResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetLogResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** This field indicates whether the Charging Station was able to accept the request. */
+ private LogStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * The name of the log file that will be uploaded. This field is not present when no logging
+ * information is available.
+ */
+ @Nullable private String filename;
+
+ /**
+ * Constructor for the GetLogResponse class
+ *
+ * @param status This field indicates whether the Charging Station was able to accept the request.
+ */
+ public GetLogResponse(LogStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetLogResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets this field indicates whether the Charging Station was able to accept the request.
+ *
+ * @return This field indicates whether the Charging Station was able to accept the request
+ */
+ public LogStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets this field indicates whether the Charging Station was able to accept the request.
+ *
+ * @param status This field indicates whether the Charging Station was able to accept the request
+ */
+ public void setStatus(LogStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(LogStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public GetLogResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ /**
+ * Gets the name of the log file that will be uploaded. This field is not present when no logging
+ * information is available.
+ *
+ * @return The name of the log file that will be uploaded
+ */
+ @Nullable
+ public String getFilename() {
+ return filename;
+ }
+
+ /**
+ * Sets the name of the log file that will be uploaded. This field is not present when no logging
+ * information is available.
+ *
+ * @param filename The name of the log file that will be uploaded
+ */
+ public void setFilename(@Nullable String filename) {
+ if (!isValidFilename(filename)) {
+ throw new PropertyConstraintException(filename, "filename is invalid");
+ }
+ this.filename = filename;
+ }
+
+ /**
+ * Returns whether the given filename is valid
+ *
+ * @param filename the filename to check the validity of
+ * @return {@code true} if filename is valid, {@code false} if not
+ */
+ private boolean isValidFilename(@Nullable String filename) {
+ return filename == null || filename.length() <= 255;
+ }
+
+ /**
+ * Adds the name of the log file that will be uploaded. This field is not present when no logging
+ * information is available.
+ *
+ * @param filename The name of the log file that will be uploaded
+ * @return this
+ */
+ public GetLogResponse withFilename(@Nullable String filename) {
+ setFilename(filename);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidStatus(status)
+ && isValidStatusInfo(statusInfo)
+ && isValidFilename(filename);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetLogResponse that = (GetLogResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo)
+ && Objects.equals(filename, that.filename);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo, filename);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("filename", filename)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetMonitoringReportRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetMonitoringReportRequest.java
new file mode 100644
index 000000000..d2c955c7e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetMonitoringReportRequest.java
@@ -0,0 +1,281 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ComponentVariable;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.MonitoringCriterionEnum;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetMonitoringReportRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetMonitoringReportRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Class to report components, variables and variable attributes and characteristics. */
+ @Nullable private ComponentVariable[] componentVariable;
+
+ /** The Id of the request. */
+ private Integer requestId;
+
+ /** This field contains criteria for components for which a monitoring report is requested */
+ @Nullable private MonitoringCriterionEnum[] monitoringCriteria;
+
+ /**
+ * Constructor for the GetMonitoringReportRequest class
+ *
+ * @param requestId The Id of the request.
+ */
+ public GetMonitoringReportRequest(Integer requestId) {
+ setRequestId(requestId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetMonitoringReportRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets class to report components, variables and variable attributes and characteristics.
+ *
+ * @return Class to report components, variables and variable attributes and characteristics
+ */
+ @Nullable
+ public ComponentVariable[] getComponentVariable() {
+ return componentVariable;
+ }
+
+ /**
+ * Sets class to report components, variables and variable attributes and characteristics.
+ *
+ * @param componentVariable Class to report components, variables and variable attributes and
+ * characteristics
+ */
+ public void setComponentVariable(@Nullable ComponentVariable[] componentVariable) {
+ if (!isValidComponentVariable(componentVariable)) {
+ throw new PropertyConstraintException(componentVariable, "componentVariable is invalid");
+ }
+ this.componentVariable = componentVariable;
+ }
+
+ /**
+ * Returns whether the given componentVariable is valid
+ *
+ * @param componentVariable the componentVariable to check the validity of
+ * @return {@code true} if componentVariable is valid, {@code false} if not
+ */
+ private boolean isValidComponentVariable(@Nullable ComponentVariable[] componentVariable) {
+ return componentVariable == null
+ || (componentVariable.length >= 1
+ && Arrays.stream(componentVariable).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds class to report components, variables and variable attributes and characteristics.
+ *
+ * @param componentVariable Class to report components, variables and variable attributes and
+ * characteristics
+ * @return this
+ */
+ public GetMonitoringReportRequest withComponentVariable(
+ @Nullable ComponentVariable[] componentVariable) {
+ setComponentVariable(componentVariable);
+ return this;
+ }
+
+ /**
+ * Gets the Id of the request.
+ *
+ * @return The Id of the request
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the Id of the request.
+ *
+ * @param requestId The Id of the request
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets this field contains criteria for components for which a monitoring report is requested
+ *
+ * @return This field contains criteria for components for which a monitoring report is requested
+ */
+ @Nullable
+ public MonitoringCriterionEnum[] getMonitoringCriteria() {
+ return monitoringCriteria;
+ }
+
+ /**
+ * Sets this field contains criteria for components for which a monitoring report is requested
+ *
+ * @param monitoringCriteria This field contains criteria for components for which a monitoring
+ * report is requested
+ */
+ public void setMonitoringCriteria(@Nullable MonitoringCriterionEnum[] monitoringCriteria) {
+ if (!isValidMonitoringCriteria(monitoringCriteria)) {
+ throw new PropertyConstraintException(monitoringCriteria, "monitoringCriteria is invalid");
+ }
+ this.monitoringCriteria = monitoringCriteria;
+ }
+
+ /**
+ * Returns whether the given monitoringCriteria is valid
+ *
+ * @param monitoringCriteria the monitoringCriteria to check the validity of
+ * @return {@code true} if monitoringCriteria is valid, {@code false} if not
+ */
+ private boolean isValidMonitoringCriteria(
+ @Nullable MonitoringCriterionEnum[] monitoringCriteria) {
+ return monitoringCriteria == null
+ || (monitoringCriteria.length >= 1 && monitoringCriteria.length <= 3);
+ }
+
+ /**
+ * Adds this field contains criteria for components for which a monitoring report is requested
+ *
+ * @param monitoringCriteria This field contains criteria for components for which a monitoring
+ * report is requested
+ * @return this
+ */
+ public GetMonitoringReportRequest withMonitoringCriteria(
+ @Nullable MonitoringCriterionEnum[] monitoringCriteria) {
+ setMonitoringCriteria(monitoringCriteria);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidComponentVariable(componentVariable)
+ && isValidRequestId(requestId)
+ && isValidMonitoringCriteria(monitoringCriteria);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetMonitoringReportRequest that = (GetMonitoringReportRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(componentVariable, that.componentVariable)
+ && Objects.equals(requestId, that.requestId)
+ && Arrays.equals(monitoringCriteria, that.monitoringCriteria);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ Arrays.hashCode(componentVariable),
+ requestId,
+ Arrays.hashCode(monitoringCriteria));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("componentVariable", componentVariable)
+ .add("requestId", requestId)
+ .add("monitoringCriteria", monitoringCriteria)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetMonitoringReportResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetMonitoringReportResponse.java
new file mode 100644
index 000000000..d1b9eabf8
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetMonitoringReportResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GenericDeviceModelStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetMonitoringReportResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetMonitoringReportResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** This field indicates whether the Charging Station was able to accept the request. */
+ private GenericDeviceModelStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the GetMonitoringReportResponse class
+ *
+ * @param status This field indicates whether the Charging Station was able to accept the request.
+ */
+ public GetMonitoringReportResponse(GenericDeviceModelStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetMonitoringReportResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets this field indicates whether the Charging Station was able to accept the request.
+ *
+ * @return This field indicates whether the Charging Station was able to accept the request
+ */
+ public GenericDeviceModelStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets this field indicates whether the Charging Station was able to accept the request.
+ *
+ * @param status This field indicates whether the Charging Station was able to accept the request
+ */
+ public void setStatus(GenericDeviceModelStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GenericDeviceModelStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public GetMonitoringReportResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetMonitoringReportResponse that = (GetMonitoringReportResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetReportRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetReportRequest.java
new file mode 100644
index 000000000..1aa6cd412
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetReportRequest.java
@@ -0,0 +1,279 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ComponentCriterionEnum;
+import eu.chargetime.ocpp.v201.model.types.ComponentVariable;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetReportRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetReportRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Class to report components, variables and variable attributes and characteristics. */
+ @Nullable private ComponentVariable[] componentVariable;
+
+ /** The Id of the request. */
+ private Integer requestId;
+
+ /** This field contains criteria for components for which a report is requested */
+ @Nullable private ComponentCriterionEnum[] componentCriteria;
+
+ /**
+ * Constructor for the GetReportRequest class
+ *
+ * @param requestId The Id of the request.
+ */
+ public GetReportRequest(Integer requestId) {
+ setRequestId(requestId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetReportRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets class to report components, variables and variable attributes and characteristics.
+ *
+ * @return Class to report components, variables and variable attributes and characteristics
+ */
+ @Nullable
+ public ComponentVariable[] getComponentVariable() {
+ return componentVariable;
+ }
+
+ /**
+ * Sets class to report components, variables and variable attributes and characteristics.
+ *
+ * @param componentVariable Class to report components, variables and variable attributes and
+ * characteristics
+ */
+ public void setComponentVariable(@Nullable ComponentVariable[] componentVariable) {
+ if (!isValidComponentVariable(componentVariable)) {
+ throw new PropertyConstraintException(componentVariable, "componentVariable is invalid");
+ }
+ this.componentVariable = componentVariable;
+ }
+
+ /**
+ * Returns whether the given componentVariable is valid
+ *
+ * @param componentVariable the componentVariable to check the validity of
+ * @return {@code true} if componentVariable is valid, {@code false} if not
+ */
+ private boolean isValidComponentVariable(@Nullable ComponentVariable[] componentVariable) {
+ return componentVariable == null
+ || (componentVariable.length >= 1
+ && Arrays.stream(componentVariable).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds class to report components, variables and variable attributes and characteristics.
+ *
+ * @param componentVariable Class to report components, variables and variable attributes and
+ * characteristics
+ * @return this
+ */
+ public GetReportRequest withComponentVariable(@Nullable ComponentVariable[] componentVariable) {
+ setComponentVariable(componentVariable);
+ return this;
+ }
+
+ /**
+ * Gets the Id of the request.
+ *
+ * @return The Id of the request
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the Id of the request.
+ *
+ * @param requestId The Id of the request
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets this field contains criteria for components for which a report is requested
+ *
+ * @return This field contains criteria for components for which a report is requested
+ */
+ @Nullable
+ public ComponentCriterionEnum[] getComponentCriteria() {
+ return componentCriteria;
+ }
+
+ /**
+ * Sets this field contains criteria for components for which a report is requested
+ *
+ * @param componentCriteria This field contains criteria for components for which a report is
+ * requested
+ */
+ public void setComponentCriteria(@Nullable ComponentCriterionEnum[] componentCriteria) {
+ if (!isValidComponentCriteria(componentCriteria)) {
+ throw new PropertyConstraintException(componentCriteria, "componentCriteria is invalid");
+ }
+ this.componentCriteria = componentCriteria;
+ }
+
+ /**
+ * Returns whether the given componentCriteria is valid
+ *
+ * @param componentCriteria the componentCriteria to check the validity of
+ * @return {@code true} if componentCriteria is valid, {@code false} if not
+ */
+ private boolean isValidComponentCriteria(@Nullable ComponentCriterionEnum[] componentCriteria) {
+ return componentCriteria == null
+ || (componentCriteria.length >= 1 && componentCriteria.length <= 4);
+ }
+
+ /**
+ * Adds this field contains criteria for components for which a report is requested
+ *
+ * @param componentCriteria This field contains criteria for components for which a report is
+ * requested
+ * @return this
+ */
+ public GetReportRequest withComponentCriteria(
+ @Nullable ComponentCriterionEnum[] componentCriteria) {
+ setComponentCriteria(componentCriteria);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidComponentVariable(componentVariable)
+ && isValidRequestId(requestId)
+ && isValidComponentCriteria(componentCriteria);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetReportRequest that = (GetReportRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(componentVariable, that.componentVariable)
+ && Objects.equals(requestId, that.requestId)
+ && Arrays.equals(componentCriteria, that.componentCriteria);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ Arrays.hashCode(componentVariable),
+ requestId,
+ Arrays.hashCode(componentCriteria));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("componentVariable", componentVariable)
+ .add("requestId", requestId)
+ .add("componentCriteria", componentCriteria)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetReportResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetReportResponse.java
new file mode 100644
index 000000000..a3a4504c3
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetReportResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GenericDeviceModelStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetReportResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetReportResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** This field indicates whether the Charging Station was able to accept the request. */
+ private GenericDeviceModelStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the GetReportResponse class
+ *
+ * @param status This field indicates whether the Charging Station was able to accept the request.
+ */
+ public GetReportResponse(GenericDeviceModelStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetReportResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets this field indicates whether the Charging Station was able to accept the request.
+ *
+ * @return This field indicates whether the Charging Station was able to accept the request
+ */
+ public GenericDeviceModelStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets this field indicates whether the Charging Station was able to accept the request.
+ *
+ * @param status This field indicates whether the Charging Station was able to accept the request
+ */
+ public void setStatus(GenericDeviceModelStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GenericDeviceModelStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public GetReportResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetReportResponse that = (GetReportResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetTransactionStatusRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetTransactionStatusRequest.java
new file mode 100644
index 000000000..c2a642fff
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetTransactionStatusRequest.java
@@ -0,0 +1,171 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetTransactionStatusRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetTransactionStatusRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The Id of the transaction for which the status is requested. */
+ @Nullable private String transactionId;
+
+ /** Constructor for the GetTransactionStatusRequest class */
+ public GetTransactionStatusRequest() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetTransactionStatusRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the Id of the transaction for which the status is requested.
+ *
+ * @return The Id of the transaction for which the status is requested
+ */
+ @Nullable
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ /**
+ * Sets the Id of the transaction for which the status is requested.
+ *
+ * @param transactionId The Id of the transaction for which the status is requested
+ */
+ public void setTransactionId(@Nullable String transactionId) {
+ if (!isValidTransactionId(transactionId)) {
+ throw new PropertyConstraintException(transactionId, "transactionId is invalid");
+ }
+ this.transactionId = transactionId;
+ }
+
+ /**
+ * Returns whether the given transactionId is valid
+ *
+ * @param transactionId the transactionId to check the validity of
+ * @return {@code true} if transactionId is valid, {@code false} if not
+ */
+ private boolean isValidTransactionId(@Nullable String transactionId) {
+ return transactionId == null || transactionId.length() <= 36;
+ }
+
+ /**
+ * Adds the Id of the transaction for which the status is requested.
+ *
+ * @param transactionId The Id of the transaction for which the status is requested
+ * @return this
+ */
+ public GetTransactionStatusRequest withTransactionId(@Nullable String transactionId) {
+ setTransactionId(transactionId);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidTransactionId(transactionId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetTransactionStatusRequest that = (GetTransactionStatusRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(transactionId, that.transactionId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, transactionId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("transactionId", transactionId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetTransactionStatusResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetTransactionStatusResponse.java
new file mode 100644
index 000000000..c8a2e88ae
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetTransactionStatusResponse.java
@@ -0,0 +1,195 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetTransactionStatusResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetTransactionStatusResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the transaction is still ongoing. */
+ @Nullable private Boolean ongoingIndicator;
+
+ /** Whether there are still message to be delivered. */
+ private Boolean messagesInQueue;
+
+ /**
+ * Constructor for the GetTransactionStatusResponse class
+ *
+ * @param messagesInQueue Whether there are still message to be delivered.
+ */
+ public GetTransactionStatusResponse(Boolean messagesInQueue) {
+ setMessagesInQueue(messagesInQueue);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetTransactionStatusResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the transaction is still ongoing.
+ *
+ * @return Whether the transaction is still ongoing
+ */
+ @Nullable
+ public Boolean getOngoingIndicator() {
+ return ongoingIndicator;
+ }
+
+ /**
+ * Sets whether the transaction is still ongoing.
+ *
+ * @param ongoingIndicator Whether the transaction is still ongoing
+ */
+ public void setOngoingIndicator(@Nullable Boolean ongoingIndicator) {
+ this.ongoingIndicator = ongoingIndicator;
+ }
+
+ /**
+ * Adds whether the transaction is still ongoing.
+ *
+ * @param ongoingIndicator Whether the transaction is still ongoing
+ * @return this
+ */
+ public GetTransactionStatusResponse withOngoingIndicator(@Nullable Boolean ongoingIndicator) {
+ setOngoingIndicator(ongoingIndicator);
+ return this;
+ }
+
+ /**
+ * Gets whether there are still message to be delivered.
+ *
+ * @return Whether there are still message to be delivered
+ */
+ public Boolean getMessagesInQueue() {
+ return messagesInQueue;
+ }
+
+ /**
+ * Sets whether there are still message to be delivered.
+ *
+ * @param messagesInQueue Whether there are still message to be delivered
+ */
+ public void setMessagesInQueue(Boolean messagesInQueue) {
+ if (!isValidMessagesInQueue(messagesInQueue)) {
+ throw new PropertyConstraintException(messagesInQueue, "messagesInQueue is invalid");
+ }
+ this.messagesInQueue = messagesInQueue;
+ }
+
+ /**
+ * Returns whether the given messagesInQueue is valid
+ *
+ * @param messagesInQueue the messagesInQueue to check the validity of
+ * @return {@code true} if messagesInQueue is valid, {@code false} if not
+ */
+ private boolean isValidMessagesInQueue(Boolean messagesInQueue) {
+ return messagesInQueue != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidMessagesInQueue(messagesInQueue);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetTransactionStatusResponse that = (GetTransactionStatusResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(ongoingIndicator, that.ongoingIndicator)
+ && Objects.equals(messagesInQueue, that.messagesInQueue);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, ongoingIndicator, messagesInQueue);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("ongoingIndicator", ongoingIndicator)
+ .add("messagesInQueue", messagesInQueue)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetVariablesRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetVariablesRequest.java
new file mode 100644
index 000000000..73a118d4c
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetVariablesRequest.java
@@ -0,0 +1,169 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GetVariableData;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetVariablesRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetVariablesRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Class to hold parameters for GetVariables request. */
+ private GetVariableData[] getVariableData;
+
+ /**
+ * Constructor for the GetVariablesRequest class
+ *
+ * @param getVariableData Class to hold parameters for GetVariables request.
+ */
+ public GetVariablesRequest(GetVariableData[] getVariableData) {
+ setGetVariableData(getVariableData);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetVariablesRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets class to hold parameters for GetVariables request.
+ *
+ * @return Class to hold parameters for GetVariables request
+ */
+ public GetVariableData[] getGetVariableData() {
+ return getVariableData;
+ }
+
+ /**
+ * Sets class to hold parameters for GetVariables request.
+ *
+ * @param getVariableData Class to hold parameters for GetVariables request
+ */
+ public void setGetVariableData(GetVariableData[] getVariableData) {
+ if (!isValidGetVariableData(getVariableData)) {
+ throw new PropertyConstraintException(getVariableData, "getVariableData is invalid");
+ }
+ this.getVariableData = getVariableData;
+ }
+
+ /**
+ * Returns whether the given getVariableData is valid
+ *
+ * @param getVariableData the getVariableData to check the validity of
+ * @return {@code true} if getVariableData is valid, {@code false} if not
+ */
+ private boolean isValidGetVariableData(GetVariableData[] getVariableData) {
+ return getVariableData != null
+ && getVariableData.length >= 1
+ && Arrays.stream(getVariableData).allMatch(item -> item.validate());
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidGetVariableData(getVariableData);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetVariablesRequest that = (GetVariablesRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(getVariableData, that.getVariableData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(getVariableData));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("getVariableData", getVariableData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetVariablesResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetVariablesResponse.java
new file mode 100644
index 000000000..21a24926c
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/GetVariablesResponse.java
@@ -0,0 +1,164 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GetVariableResult;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * GetVariablesResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class GetVariablesResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Class to hold results of GetVariables request. */
+ private GetVariableResult[] getVariableResult;
+
+ /**
+ * Constructor for the GetVariablesResponse class
+ *
+ * @param getVariableResult Class to hold results of GetVariables request.
+ */
+ public GetVariablesResponse(GetVariableResult[] getVariableResult) {
+ setGetVariableResult(getVariableResult);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetVariablesResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets class to hold results of GetVariables request.
+ *
+ * @return Class to hold results of GetVariables request
+ */
+ public GetVariableResult[] getGetVariableResult() {
+ return getVariableResult;
+ }
+
+ /**
+ * Sets class to hold results of GetVariables request.
+ *
+ * @param getVariableResult Class to hold results of GetVariables request
+ */
+ public void setGetVariableResult(GetVariableResult[] getVariableResult) {
+ if (!isValidGetVariableResult(getVariableResult)) {
+ throw new PropertyConstraintException(getVariableResult, "getVariableResult is invalid");
+ }
+ this.getVariableResult = getVariableResult;
+ }
+
+ /**
+ * Returns whether the given getVariableResult is valid
+ *
+ * @param getVariableResult the getVariableResult to check the validity of
+ * @return {@code true} if getVariableResult is valid, {@code false} if not
+ */
+ private boolean isValidGetVariableResult(GetVariableResult[] getVariableResult) {
+ return getVariableResult != null
+ && getVariableResult.length >= 1
+ && Arrays.stream(getVariableResult).allMatch(item -> item.validate());
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidGetVariableResult(getVariableResult);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetVariablesResponse that = (GetVariablesResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(getVariableResult, that.getVariableResult);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(getVariableResult));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("getVariableResult", getVariableResult)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/HeartbeatRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/HeartbeatRequest.java
new file mode 100644
index 000000000..d35a3d9ab
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/HeartbeatRequest.java
@@ -0,0 +1,123 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * HeartbeatRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class HeartbeatRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the HeartbeatRequest class */
+ public HeartbeatRequest() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public HeartbeatRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ HeartbeatRequest that = (HeartbeatRequest) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/HeartbeatResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/HeartbeatResponse.java
new file mode 100644
index 000000000..c06b472cc
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/HeartbeatResponse.java
@@ -0,0 +1,161 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * HeartbeatResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class HeartbeatResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The current time of the CSMS. */
+ private ZonedDateTime currentTime;
+
+ /**
+ * Constructor for the HeartbeatResponse class
+ *
+ * @param currentTime The current time of the CSMS.
+ */
+ public HeartbeatResponse(ZonedDateTime currentTime) {
+ setCurrentTime(currentTime);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public HeartbeatResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the current time of the CSMS.
+ *
+ * @return The current time of the CSMS
+ */
+ public ZonedDateTime getCurrentTime() {
+ return currentTime;
+ }
+
+ /**
+ * Sets the current time of the CSMS.
+ *
+ * @param currentTime The current time of the CSMS
+ */
+ public void setCurrentTime(ZonedDateTime currentTime) {
+ if (!isValidCurrentTime(currentTime)) {
+ throw new PropertyConstraintException(currentTime, "currentTime is invalid");
+ }
+ this.currentTime = currentTime;
+ }
+
+ /**
+ * Returns whether the given currentTime is valid
+ *
+ * @param currentTime the currentTime to check the validity of
+ * @return {@code true} if currentTime is valid, {@code false} if not
+ */
+ private boolean isValidCurrentTime(ZonedDateTime currentTime) {
+ return currentTime != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidCurrentTime(currentTime);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ HeartbeatResponse that = (HeartbeatResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(currentTime, that.currentTime);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, currentTime);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("currentTime", currentTime)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/InstallCertificateRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/InstallCertificateRequest.java
new file mode 100644
index 000000000..9f10ca4d6
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/InstallCertificateRequest.java
@@ -0,0 +1,206 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.InstallCertificateUseEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * InstallCertificateRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class InstallCertificateRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The certificate type that is sent. */
+ private InstallCertificateUseEnum certificateType;
+
+ /** A PEM encoded X.509 certificate. */
+ private String certificate;
+
+ /**
+ * Constructor for the InstallCertificateRequest class
+ *
+ * @param certificateType The certificate type that is sent.
+ * @param certificate A PEM encoded X.509 certificate.
+ */
+ public InstallCertificateRequest(InstallCertificateUseEnum certificateType, String certificate) {
+ setCertificateType(certificateType);
+ setCertificate(certificate);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public InstallCertificateRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the certificate type that is sent.
+ *
+ * @return The certificate type that is sent
+ */
+ public InstallCertificateUseEnum getCertificateType() {
+ return certificateType;
+ }
+
+ /**
+ * Sets the certificate type that is sent.
+ *
+ * @param certificateType The certificate type that is sent
+ */
+ public void setCertificateType(InstallCertificateUseEnum certificateType) {
+ if (!isValidCertificateType(certificateType)) {
+ throw new PropertyConstraintException(certificateType, "certificateType is invalid");
+ }
+ this.certificateType = certificateType;
+ }
+
+ /**
+ * Returns whether the given certificateType is valid
+ *
+ * @param certificateType the certificateType to check the validity of
+ * @return {@code true} if certificateType is valid, {@code false} if not
+ */
+ private boolean isValidCertificateType(InstallCertificateUseEnum certificateType) {
+ return certificateType != null;
+ }
+
+ /**
+ * Gets a PEM encoded X.509 certificate.
+ *
+ * @return A PEM encoded X.509 certificate
+ */
+ public String getCertificate() {
+ return certificate;
+ }
+
+ /**
+ * Sets a PEM encoded X.509 certificate.
+ *
+ * @param certificate A PEM encoded X.509 certificate
+ */
+ public void setCertificate(String certificate) {
+ if (!isValidCertificate(certificate)) {
+ throw new PropertyConstraintException(certificate, "certificate is invalid");
+ }
+ this.certificate = certificate;
+ }
+
+ /**
+ * Returns whether the given certificate is valid
+ *
+ * @param certificate the certificate to check the validity of
+ * @return {@code true} if certificate is valid, {@code false} if not
+ */
+ private boolean isValidCertificate(String certificate) {
+ return certificate != null && certificate.length() <= 5500;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidCertificateType(certificateType)
+ && isValidCertificate(certificate);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ InstallCertificateRequest that = (InstallCertificateRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(certificateType, that.certificateType)
+ && Objects.equals(certificate, that.certificate);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, certificateType, certificate);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("certificateType", certificateType)
+ .add("certificate", certificate)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/InstallCertificateResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/InstallCertificateResponse.java
new file mode 100644
index 000000000..698c3368d
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/InstallCertificateResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.InstallCertificateStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * InstallCertificateResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class InstallCertificateResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Charging Station indicates if installation was successful. */
+ private InstallCertificateStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the InstallCertificateResponse class
+ *
+ * @param status Charging Station indicates if installation was successful.
+ */
+ public InstallCertificateResponse(InstallCertificateStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public InstallCertificateResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets charging Station indicates if installation was successful.
+ *
+ * @return Charging Station indicates if installation was successful
+ */
+ public InstallCertificateStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets charging Station indicates if installation was successful.
+ *
+ * @param status Charging Station indicates if installation was successful
+ */
+ public void setStatus(InstallCertificateStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(InstallCertificateStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public InstallCertificateResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ InstallCertificateResponse that = (InstallCertificateResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/LogStatusNotificationRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/LogStatusNotificationRequest.java
new file mode 100644
index 000000000..63dd2593e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/LogStatusNotificationRequest.java
@@ -0,0 +1,211 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.UploadLogStatusEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * LogStatusNotificationRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class LogStatusNotificationRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The status of the log upload. */
+ private UploadLogStatusEnum status;
+
+ /**
+ * The request id that was provided in GetLogRequest that started this log upload. This field is
+ * mandatory, unless the message was triggered by a TriggerMessageRequest AND there is no log
+ * upload ongoing.
+ */
+ @Nullable private Integer requestId;
+
+ /**
+ * Constructor for the LogStatusNotificationRequest class
+ *
+ * @param status The status of the log upload.
+ */
+ public LogStatusNotificationRequest(UploadLogStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public LogStatusNotificationRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the status of the log upload.
+ *
+ * @return The status of the log upload
+ */
+ public UploadLogStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the status of the log upload.
+ *
+ * @param status The status of the log upload
+ */
+ public void setStatus(UploadLogStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(UploadLogStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets the request id that was provided in GetLogRequest that started this log upload. This field
+ * is mandatory, unless the message was triggered by a TriggerMessageRequest AND there is no log
+ * upload ongoing.
+ *
+ * @return The request id that was provided in GetLogRequest that started this log upload
+ */
+ @Nullable
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the request id that was provided in GetLogRequest that started this log upload. This field
+ * is mandatory, unless the message was triggered by a TriggerMessageRequest AND there is no log
+ * upload ongoing.
+ *
+ * @param requestId The request id that was provided in GetLogRequest that started this log upload
+ */
+ public void setRequestId(@Nullable Integer requestId) {
+ this.requestId = requestId;
+ }
+
+ /**
+ * Adds the request id that was provided in GetLogRequest that started this log upload. This field
+ * is mandatory, unless the message was triggered by a TriggerMessageRequest AND there is no log
+ * upload ongoing.
+ *
+ * @param requestId The request id that was provided in GetLogRequest that started this log upload
+ * @return this
+ */
+ public LogStatusNotificationRequest withRequestId(@Nullable Integer requestId) {
+ setRequestId(requestId);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ LogStatusNotificationRequest that = (LogStatusNotificationRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(requestId, that.requestId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, requestId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("requestId", requestId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/LogStatusNotificationResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/LogStatusNotificationResponse.java
new file mode 100644
index 000000000..99f925cdb
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/LogStatusNotificationResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * LogStatusNotificationResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class LogStatusNotificationResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the LogStatusNotificationResponse class */
+ public LogStatusNotificationResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public LogStatusNotificationResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ LogStatusNotificationResponse that = (LogStatusNotificationResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/MeterValuesRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/MeterValuesRequest.java
new file mode 100644
index 000000000..ed9d7c2c7
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/MeterValuesRequest.java
@@ -0,0 +1,224 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.MeterValue;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Request Body
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class MeterValuesRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Request Body. EVSEID. Numeric Identifier
+ *
+ * A number (greater than 0) designating an EVSE of the Charging Station. â0â (zero) is used to
+ * designate the main power meter.
+ */
+ private Integer evseId;
+
+ /**
+ * Meter Value
+ *
+ * Collection of one or more sampled values in MeterValuesRequest and TransactionEvent. All
+ * sampled values in a MeterValue are sampled at the same point in time.
+ */
+ private MeterValue[] meterValue;
+
+ /**
+ * Constructor for the MeterValuesRequest class
+ *
+ * @param evseId A number (greater than 0) designating an EVSE of the Charging Station. â0â (zero)
+ * is used to designate the main power meter.
+ * @param meterValue Collection of one or more sampled values in MeterValuesRequest and
+ * TransactionEvent. All sampled values in a MeterValue are sampled at the same point in time.
+ */
+ public MeterValuesRequest(Integer evseId, MeterValue[] meterValue) {
+ setEvseId(evseId);
+ setMeterValue(meterValue);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public MeterValuesRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets a number (greater than 0) designating an EVSE of the Charging Station. â0â (zero) is used
+ * to designate the main power meter.
+ *
+ * @return A number (greater than 0) designating an EVSE of the Charging Station
+ */
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets a number (greater than 0) designating an EVSE of the Charging Station. â0â (zero) is used
+ * to designate the main power meter.
+ *
+ * @param evseId A number (greater than 0) designating an EVSE of the Charging Station
+ */
+ public void setEvseId(Integer evseId) {
+ if (!isValidEvseId(evseId)) {
+ throw new PropertyConstraintException(evseId, "evseId is invalid");
+ }
+ this.evseId = evseId;
+ }
+
+ /**
+ * Returns whether the given evseId is valid
+ *
+ * @param evseId the evseId to check the validity of
+ * @return {@code true} if evseId is valid, {@code false} if not
+ */
+ private boolean isValidEvseId(Integer evseId) {
+ return evseId != null;
+ }
+
+ /**
+ * Gets collection of one or more sampled values in MeterValuesRequest and TransactionEvent. All
+ * sampled values in a MeterValue are sampled at the same point in time.
+ *
+ * @return Collection of one or more sampled values in MeterValuesRequest and TransactionEvent
+ */
+ public MeterValue[] getMeterValue() {
+ return meterValue;
+ }
+
+ /**
+ * Sets collection of one or more sampled values in MeterValuesRequest and TransactionEvent. All
+ * sampled values in a MeterValue are sampled at the same point in time.
+ *
+ * @param meterValue Collection of one or more sampled values in MeterValuesRequest and
+ * TransactionEvent
+ */
+ public void setMeterValue(MeterValue[] meterValue) {
+ if (!isValidMeterValue(meterValue)) {
+ throw new PropertyConstraintException(meterValue, "meterValue is invalid");
+ }
+ this.meterValue = meterValue;
+ }
+
+ /**
+ * Returns whether the given meterValue is valid
+ *
+ * @param meterValue the meterValue to check the validity of
+ * @return {@code true} if meterValue is valid, {@code false} if not
+ */
+ private boolean isValidMeterValue(MeterValue[] meterValue) {
+ return meterValue != null
+ && meterValue.length >= 1
+ && Arrays.stream(meterValue).allMatch(item -> item.validate());
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidEvseId(evseId) && isValidMeterValue(meterValue);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ MeterValuesRequest that = (MeterValuesRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(evseId, that.evseId)
+ && Arrays.equals(meterValue, that.meterValue);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, evseId, Arrays.hashCode(meterValue));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("evseId", evseId)
+ .add("meterValue", meterValue)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/MeterValuesResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/MeterValuesResponse.java
new file mode 100644
index 000000000..5b5b89a9f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/MeterValuesResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * MeterValuesResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class MeterValuesResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the MeterValuesResponse class */
+ public MeterValuesResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public MeterValuesResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ MeterValuesResponse that = (MeterValuesResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyChargingLimitRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyChargingLimitRequest.java
new file mode 100644
index 000000000..c4aa5b148
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyChargingLimitRequest.java
@@ -0,0 +1,273 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ChargingLimit;
+import eu.chargetime.ocpp.v201.model.types.ChargingSchedule;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyChargingLimitRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyChargingLimitRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Charging Schedule
+ *
+ * Charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile.
+ */
+ @Nullable private ChargingSchedule[] chargingSchedule;
+
+ /**
+ * The charging schedule contained in this notification applies to an EVSE. evseId must be greater
+ * than 0.
+ */
+ @Nullable private Integer evseId;
+
+ /** Charging Limit */
+ private ChargingLimit chargingLimit;
+
+ /**
+ * Constructor for the NotifyChargingLimitRequest class
+ *
+ * @param chargingLimit Charging Limit
+ */
+ public NotifyChargingLimitRequest(ChargingLimit chargingLimit) {
+ setChargingLimit(chargingLimit);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyChargingLimitRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile.
+ *
+ * @return Charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile
+ */
+ @Nullable
+ public ChargingSchedule[] getChargingSchedule() {
+ return chargingSchedule;
+ }
+
+ /**
+ * Sets charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile.
+ *
+ * @param chargingSchedule Charging schedule structure defines a list of charging periods, as used
+ * in: GetCompositeSchedule.conf and ChargingProfile
+ */
+ public void setChargingSchedule(@Nullable ChargingSchedule[] chargingSchedule) {
+ if (!isValidChargingSchedule(chargingSchedule)) {
+ throw new PropertyConstraintException(chargingSchedule, "chargingSchedule is invalid");
+ }
+ this.chargingSchedule = chargingSchedule;
+ }
+
+ /**
+ * Returns whether the given chargingSchedule is valid
+ *
+ * @param chargingSchedule the chargingSchedule to check the validity of
+ * @return {@code true} if chargingSchedule is valid, {@code false} if not
+ */
+ private boolean isValidChargingSchedule(@Nullable ChargingSchedule[] chargingSchedule) {
+ return chargingSchedule == null
+ || (chargingSchedule.length >= 1
+ && Arrays.stream(chargingSchedule).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile.
+ *
+ * @param chargingSchedule Charging schedule structure defines a list of charging periods, as used
+ * in: GetCompositeSchedule.conf and ChargingProfile
+ * @return this
+ */
+ public NotifyChargingLimitRequest withChargingSchedule(
+ @Nullable ChargingSchedule[] chargingSchedule) {
+ setChargingSchedule(chargingSchedule);
+ return this;
+ }
+
+ /**
+ * Gets the charging schedule contained in this notification applies to an EVSE. evseId must be
+ * greater than 0.
+ *
+ * @return The charging schedule contained in this notification applies to an EVSE
+ */
+ @Nullable
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets the charging schedule contained in this notification applies to an EVSE. evseId must be
+ * greater than 0.
+ *
+ * @param evseId The charging schedule contained in this notification applies to an EVSE
+ */
+ public void setEvseId(@Nullable Integer evseId) {
+ this.evseId = evseId;
+ }
+
+ /**
+ * Adds the charging schedule contained in this notification applies to an EVSE. evseId must be
+ * greater than 0.
+ *
+ * @param evseId The charging schedule contained in this notification applies to an EVSE
+ * @return this
+ */
+ public NotifyChargingLimitRequest withEvseId(@Nullable Integer evseId) {
+ setEvseId(evseId);
+ return this;
+ }
+
+ /**
+ * Gets charging Limit
+ *
+ * @return Charging Limit
+ */
+ public ChargingLimit getChargingLimit() {
+ return chargingLimit;
+ }
+
+ /**
+ * Sets charging Limit
+ *
+ * @param chargingLimit Charging Limit
+ */
+ public void setChargingLimit(ChargingLimit chargingLimit) {
+ if (!isValidChargingLimit(chargingLimit)) {
+ throw new PropertyConstraintException(chargingLimit, "chargingLimit is invalid");
+ }
+ this.chargingLimit = chargingLimit;
+ }
+
+ /**
+ * Returns whether the given chargingLimit is valid
+ *
+ * @param chargingLimit the chargingLimit to check the validity of
+ * @return {@code true} if chargingLimit is valid, {@code false} if not
+ */
+ private boolean isValidChargingLimit(ChargingLimit chargingLimit) {
+ return chargingLimit != null && chargingLimit.validate();
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidChargingSchedule(chargingSchedule)
+ && isValidChargingLimit(chargingLimit);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyChargingLimitRequest that = (NotifyChargingLimitRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(chargingSchedule, that.chargingSchedule)
+ && Objects.equals(evseId, that.evseId)
+ && Objects.equals(chargingLimit, that.chargingLimit);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(chargingSchedule), evseId, chargingLimit);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("chargingSchedule", chargingSchedule)
+ .add("evseId", evseId)
+ .add("chargingLimit", chargingLimit)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyChargingLimitResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyChargingLimitResponse.java
new file mode 100644
index 000000000..195a0f307
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyChargingLimitResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyChargingLimitResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyChargingLimitResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the NotifyChargingLimitResponse class */
+ public NotifyChargingLimitResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyChargingLimitResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyChargingLimitResponse that = (NotifyChargingLimitResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyCustomerInformationRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyCustomerInformationRequest.java
new file mode 100644
index 000000000..10993eb24
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyCustomerInformationRequest.java
@@ -0,0 +1,331 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyCustomerInformationRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyCustomerInformationRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * (Part of) the requested data. No format specified in which the data is returned. Should be
+ * human readable.
+ */
+ private String data;
+
+ /**
+ * âto be continuedâ indicator. Indicates whether another part of the monitoringData follows in an
+ * upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
+ */
+ @Nullable private Boolean tbc;
+
+ /** Sequence number of this message. First message starts at 0. */
+ private Integer seqNo;
+
+ /** Timestamp of the moment this message was generated at the Charging Station. */
+ private ZonedDateTime generatedAt;
+
+ /** The Id of the request. */
+ private Integer requestId;
+
+ /**
+ * Constructor for the NotifyCustomerInformationRequest class
+ *
+ * @param data (Part of) the requested data. No format specified in which the data is returned.
+ * Should be human readable.
+ * @param seqNo Sequence number of this message. First message starts at 0.
+ * @param generatedAt Timestamp of the moment this message was generated at the Charging Station.
+ * @param requestId The Id of the request.
+ */
+ public NotifyCustomerInformationRequest(
+ String data, Integer seqNo, ZonedDateTime generatedAt, Integer requestId) {
+ setData(data);
+ setSeqNo(seqNo);
+ setGeneratedAt(generatedAt);
+ setRequestId(requestId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyCustomerInformationRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets (Part of) the requested data. No format specified in which the data is returned. Should be
+ * human readable.
+ *
+ * @return (Part of) the requested data
+ */
+ public String getData() {
+ return data;
+ }
+
+ /**
+ * Sets (Part of) the requested data. No format specified in which the data is returned. Should be
+ * human readable.
+ *
+ * @param data (Part of) the requested data
+ */
+ public void setData(String data) {
+ if (!isValidData(data)) {
+ throw new PropertyConstraintException(data, "data is invalid");
+ }
+ this.data = data;
+ }
+
+ /**
+ * Returns whether the given data is valid
+ *
+ * @param data the data to check the validity of
+ * @return {@code true} if data is valid, {@code false} if not
+ */
+ private boolean isValidData(String data) {
+ return data != null && data.length() <= 512;
+ }
+
+ /**
+ * Gets âto be continuedâ indicator. Indicates whether another part of the monitoringData follows
+ * in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
+ *
+ * @return âto be continuedâ indicator
+ */
+ public Boolean getTbc() {
+ return tbc != null ? tbc : false;
+ }
+
+ /**
+ * Sets âto be continuedâ indicator. Indicates whether another part of the monitoringData follows
+ * in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
+ *
+ * @param tbc âto be continuedâ indicator
+ */
+ public void setTbc(@Nullable Boolean tbc) {
+ this.tbc = tbc;
+ }
+
+ /**
+ * Adds âto be continuedâ indicator. Indicates whether another part of the monitoringData follows
+ * in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
+ *
+ * @param tbc âto be continuedâ indicator
+ * @return this
+ */
+ public NotifyCustomerInformationRequest withTbc(@Nullable Boolean tbc) {
+ setTbc(tbc);
+ return this;
+ }
+
+ /**
+ * Gets sequence number of this message. First message starts at 0.
+ *
+ * @return Sequence number of this message
+ */
+ public Integer getSeqNo() {
+ return seqNo;
+ }
+
+ /**
+ * Sets sequence number of this message. First message starts at 0.
+ *
+ * @param seqNo Sequence number of this message
+ */
+ public void setSeqNo(Integer seqNo) {
+ if (!isValidSeqNo(seqNo)) {
+ throw new PropertyConstraintException(seqNo, "seqNo is invalid");
+ }
+ this.seqNo = seqNo;
+ }
+
+ /**
+ * Returns whether the given seqNo is valid
+ *
+ * @param seqNo the seqNo to check the validity of
+ * @return {@code true} if seqNo is valid, {@code false} if not
+ */
+ private boolean isValidSeqNo(Integer seqNo) {
+ return seqNo != null;
+ }
+
+ /**
+ * Gets timestamp of the moment this message was generated at the Charging Station.
+ *
+ * @return Timestamp of the moment this message was generated at the Charging Station
+ */
+ public ZonedDateTime getGeneratedAt() {
+ return generatedAt;
+ }
+
+ /**
+ * Sets timestamp of the moment this message was generated at the Charging Station.
+ *
+ * @param generatedAt Timestamp of the moment this message was generated at the Charging Station
+ */
+ public void setGeneratedAt(ZonedDateTime generatedAt) {
+ if (!isValidGeneratedAt(generatedAt)) {
+ throw new PropertyConstraintException(generatedAt, "generatedAt is invalid");
+ }
+ this.generatedAt = generatedAt;
+ }
+
+ /**
+ * Returns whether the given generatedAt is valid
+ *
+ * @param generatedAt the generatedAt to check the validity of
+ * @return {@code true} if generatedAt is valid, {@code false} if not
+ */
+ private boolean isValidGeneratedAt(ZonedDateTime generatedAt) {
+ return generatedAt != null;
+ }
+
+ /**
+ * Gets the Id of the request.
+ *
+ * @return The Id of the request
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the Id of the request.
+ *
+ * @param requestId The Id of the request
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidData(data)
+ && isValidSeqNo(seqNo)
+ && isValidGeneratedAt(generatedAt)
+ && isValidRequestId(requestId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyCustomerInformationRequest that = (NotifyCustomerInformationRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(data, that.data)
+ && Objects.equals(tbc, that.tbc)
+ && Objects.equals(seqNo, that.seqNo)
+ && Objects.equals(generatedAt, that.generatedAt)
+ && Objects.equals(requestId, that.requestId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, data, tbc, seqNo, generatedAt, requestId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("data", data)
+ .add("tbc", tbc)
+ .add("seqNo", seqNo)
+ .add("generatedAt", generatedAt)
+ .add("requestId", requestId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyCustomerInformationResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyCustomerInformationResponse.java
new file mode 100644
index 000000000..afbd035a6
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyCustomerInformationResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyCustomerInformationResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyCustomerInformationResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the NotifyCustomerInformationResponse class */
+ public NotifyCustomerInformationResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyCustomerInformationResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyCustomerInformationResponse that = (NotifyCustomerInformationResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyDisplayMessagesRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyDisplayMessagesRequest.java
new file mode 100644
index 000000000..64d30b7ae
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyDisplayMessagesRequest.java
@@ -0,0 +1,263 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.MessageInfo;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyDisplayMessagesRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyDisplayMessagesRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Message Info
+ *
+ * Message details, for a message to be displayed on a Charging Station.
+ */
+ @Nullable private MessageInfo[] messageInfo;
+
+ /** The id of the GetDisplayMessagesRequest that requested this message. */
+ private Integer requestId;
+
+ /**
+ * "to be continued" indicator. Indicates whether another part of the report follows in an
+ * upcoming NotifyDisplayMessagesRequest message. Default value when omitted is false.
+ */
+ @Nullable private Boolean tbc;
+
+ /**
+ * Constructor for the NotifyDisplayMessagesRequest class
+ *
+ * @param requestId The id of the GetDisplayMessagesRequest that requested this message.
+ */
+ public NotifyDisplayMessagesRequest(Integer requestId) {
+ setRequestId(requestId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyDisplayMessagesRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets message details, for a message to be displayed on a Charging Station.
+ *
+ * @return Message details, for a message to be displayed on a Charging Station
+ */
+ @Nullable
+ public MessageInfo[] getMessageInfo() {
+ return messageInfo;
+ }
+
+ /**
+ * Sets message details, for a message to be displayed on a Charging Station.
+ *
+ * @param messageInfo Message details, for a message to be displayed on a Charging Station
+ */
+ public void setMessageInfo(@Nullable MessageInfo[] messageInfo) {
+ if (!isValidMessageInfo(messageInfo)) {
+ throw new PropertyConstraintException(messageInfo, "messageInfo is invalid");
+ }
+ this.messageInfo = messageInfo;
+ }
+
+ /**
+ * Returns whether the given messageInfo is valid
+ *
+ * @param messageInfo the messageInfo to check the validity of
+ * @return {@code true} if messageInfo is valid, {@code false} if not
+ */
+ private boolean isValidMessageInfo(@Nullable MessageInfo[] messageInfo) {
+ return messageInfo == null
+ || (messageInfo.length >= 1
+ && Arrays.stream(messageInfo).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds message details, for a message to be displayed on a Charging Station.
+ *
+ * @param messageInfo Message details, for a message to be displayed on a Charging Station
+ * @return this
+ */
+ public NotifyDisplayMessagesRequest withMessageInfo(@Nullable MessageInfo[] messageInfo) {
+ setMessageInfo(messageInfo);
+ return this;
+ }
+
+ /**
+ * Gets the id of the GetDisplayMessagesRequest that requested this message.
+ *
+ * @return The id of the GetDisplayMessagesRequest that requested this message
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the id of the GetDisplayMessagesRequest that requested this message.
+ *
+ * @param requestId The id of the GetDisplayMessagesRequest that requested this message
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets "to be continued" indicator. Indicates whether another part of the report follows in an
+ * upcoming NotifyDisplayMessagesRequest message. Default value when omitted is false.
+ *
+ * @return "to be continued" indicator
+ */
+ public Boolean getTbc() {
+ return tbc != null ? tbc : false;
+ }
+
+ /**
+ * Sets "to be continued" indicator. Indicates whether another part of the report follows in an
+ * upcoming NotifyDisplayMessagesRequest message. Default value when omitted is false.
+ *
+ * @param tbc "to be continued" indicator
+ */
+ public void setTbc(@Nullable Boolean tbc) {
+ this.tbc = tbc;
+ }
+
+ /**
+ * Adds "to be continued" indicator. Indicates whether another part of the report follows in an
+ * upcoming NotifyDisplayMessagesRequest message. Default value when omitted is false.
+ *
+ * @param tbc "to be continued" indicator
+ * @return this
+ */
+ public NotifyDisplayMessagesRequest withTbc(@Nullable Boolean tbc) {
+ setTbc(tbc);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidMessageInfo(messageInfo)
+ && isValidRequestId(requestId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyDisplayMessagesRequest that = (NotifyDisplayMessagesRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(messageInfo, that.messageInfo)
+ && Objects.equals(requestId, that.requestId)
+ && Objects.equals(tbc, that.tbc);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(messageInfo), requestId, tbc);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("messageInfo", messageInfo)
+ .add("requestId", requestId)
+ .add("tbc", tbc)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyDisplayMessagesResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyDisplayMessagesResponse.java
new file mode 100644
index 000000000..efc9f989d
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyDisplayMessagesResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyDisplayMessagesResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyDisplayMessagesResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the NotifyDisplayMessagesResponse class */
+ public NotifyDisplayMessagesResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyDisplayMessagesResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyDisplayMessagesResponse that = (NotifyDisplayMessagesResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEVChargingNeedsRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEVChargingNeedsRequest.java
new file mode 100644
index 000000000..262e9d72b
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEVChargingNeedsRequest.java
@@ -0,0 +1,241 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ChargingNeeds;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyEVChargingNeedsRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyEVChargingNeedsRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The maximum schedule tuples the car supports per schedule. */
+ @Nullable private Integer maxScheduleTuples;
+
+ /** Charging Needs */
+ private ChargingNeeds chargingNeeds;
+
+ /** The EVSE and connector to which the EV is connected. EvseId may not be 0. */
+ private Integer evseId;
+
+ /**
+ * Constructor for the NotifyEVChargingNeedsRequest class
+ *
+ * @param chargingNeeds Charging Needs
+ * @param evseId The EVSE and connector to which the EV is connected. EvseId may not be 0.
+ */
+ public NotifyEVChargingNeedsRequest(ChargingNeeds chargingNeeds, Integer evseId) {
+ setChargingNeeds(chargingNeeds);
+ setEvseId(evseId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyEVChargingNeedsRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the maximum schedule tuples the car supports per schedule.
+ *
+ * @return The maximum schedule tuples the car supports per schedule
+ */
+ @Nullable
+ public Integer getMaxScheduleTuples() {
+ return maxScheduleTuples;
+ }
+
+ /**
+ * Sets the maximum schedule tuples the car supports per schedule.
+ *
+ * @param maxScheduleTuples The maximum schedule tuples the car supports per schedule
+ */
+ public void setMaxScheduleTuples(@Nullable Integer maxScheduleTuples) {
+ this.maxScheduleTuples = maxScheduleTuples;
+ }
+
+ /**
+ * Adds the maximum schedule tuples the car supports per schedule.
+ *
+ * @param maxScheduleTuples The maximum schedule tuples the car supports per schedule
+ * @return this
+ */
+ public NotifyEVChargingNeedsRequest withMaxScheduleTuples(@Nullable Integer maxScheduleTuples) {
+ setMaxScheduleTuples(maxScheduleTuples);
+ return this;
+ }
+
+ /**
+ * Gets charging Needs
+ *
+ * @return Charging Needs
+ */
+ public ChargingNeeds getChargingNeeds() {
+ return chargingNeeds;
+ }
+
+ /**
+ * Sets charging Needs
+ *
+ * @param chargingNeeds Charging Needs
+ */
+ public void setChargingNeeds(ChargingNeeds chargingNeeds) {
+ if (!isValidChargingNeeds(chargingNeeds)) {
+ throw new PropertyConstraintException(chargingNeeds, "chargingNeeds is invalid");
+ }
+ this.chargingNeeds = chargingNeeds;
+ }
+
+ /**
+ * Returns whether the given chargingNeeds is valid
+ *
+ * @param chargingNeeds the chargingNeeds to check the validity of
+ * @return {@code true} if chargingNeeds is valid, {@code false} if not
+ */
+ private boolean isValidChargingNeeds(ChargingNeeds chargingNeeds) {
+ return chargingNeeds != null && chargingNeeds.validate();
+ }
+
+ /**
+ * Gets the EVSE and connector to which the EV is connected. EvseId may not be 0.
+ *
+ * @return The EVSE and connector to which the EV is connected
+ */
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets the EVSE and connector to which the EV is connected. EvseId may not be 0.
+ *
+ * @param evseId The EVSE and connector to which the EV is connected
+ */
+ public void setEvseId(Integer evseId) {
+ if (!isValidEvseId(evseId)) {
+ throw new PropertyConstraintException(evseId, "evseId is invalid");
+ }
+ this.evseId = evseId;
+ }
+
+ /**
+ * Returns whether the given evseId is valid
+ *
+ * @param evseId the evseId to check the validity of
+ * @return {@code true} if evseId is valid, {@code false} if not
+ */
+ private boolean isValidEvseId(Integer evseId) {
+ return evseId != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidChargingNeeds(chargingNeeds)
+ && isValidEvseId(evseId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyEVChargingNeedsRequest that = (NotifyEVChargingNeedsRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(maxScheduleTuples, that.maxScheduleTuples)
+ && Objects.equals(chargingNeeds, that.chargingNeeds)
+ && Objects.equals(evseId, that.evseId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, maxScheduleTuples, chargingNeeds, evseId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("maxScheduleTuples", maxScheduleTuples)
+ .add("chargingNeeds", chargingNeeds)
+ .add("evseId", evseId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEVChargingNeedsResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEVChargingNeedsResponse.java
new file mode 100644
index 000000000..1c4f646f8
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEVChargingNeedsResponse.java
@@ -0,0 +1,216 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.NotifyEVChargingNeedsStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyEVChargingNeedsResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyEVChargingNeedsResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Returns whether the CSMS has been able to process the message successfully. It does not imply
+ * that the evChargingNeeds can be met with the current charging profile.
+ */
+ private NotifyEVChargingNeedsStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the NotifyEVChargingNeedsResponse class
+ *
+ * @param status Returns whether the CSMS has been able to process the message successfully. It
+ * does not imply that the evChargingNeeds can be met with the current charging profile.
+ */
+ public NotifyEVChargingNeedsResponse(NotifyEVChargingNeedsStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyEVChargingNeedsResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets returns whether the CSMS has been able to process the message successfully. It does not
+ * imply that the evChargingNeeds can be met with the current charging profile.
+ *
+ * @return Returns whether the CSMS has been able to process the message successfully
+ */
+ public NotifyEVChargingNeedsStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets returns whether the CSMS has been able to process the message successfully. It does not
+ * imply that the evChargingNeeds can be met with the current charging profile.
+ *
+ * @param status Returns whether the CSMS has been able to process the message successfully
+ */
+ public void setStatus(NotifyEVChargingNeedsStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(NotifyEVChargingNeedsStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public NotifyEVChargingNeedsResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyEVChargingNeedsResponse that = (NotifyEVChargingNeedsResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEVChargingScheduleRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEVChargingScheduleRequest.java
new file mode 100644
index 000000000..382ad7a4c
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEVChargingScheduleRequest.java
@@ -0,0 +1,263 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ChargingSchedule;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyEVChargingScheduleRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyEVChargingScheduleRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Periods contained in the charging profile are relative to this point in time. */
+ private ZonedDateTime timeBase;
+
+ /**
+ * Charging Schedule
+ *
+ * Charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile.
+ */
+ private ChargingSchedule chargingSchedule;
+
+ /**
+ * The charging schedule contained in this notification applies to an EVSE. EvseId must be greater
+ * than 0.
+ */
+ private Integer evseId;
+
+ /**
+ * Constructor for the NotifyEVChargingScheduleRequest class
+ *
+ * @param timeBase Periods contained in the charging profile are relative to this point in time.
+ * @param chargingSchedule Charging schedule structure defines a list of charging periods, as used
+ * in: GetCompositeSchedule.conf and ChargingProfile.
+ * @param evseId The charging schedule contained in this notification applies to an EVSE. EvseId
+ * must be greater than 0.
+ */
+ public NotifyEVChargingScheduleRequest(
+ ZonedDateTime timeBase, ChargingSchedule chargingSchedule, Integer evseId) {
+ setTimeBase(timeBase);
+ setChargingSchedule(chargingSchedule);
+ setEvseId(evseId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyEVChargingScheduleRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets periods contained in the charging profile are relative to this point in time.
+ *
+ * @return Periods contained in the charging profile are relative to this point in time
+ */
+ public ZonedDateTime getTimeBase() {
+ return timeBase;
+ }
+
+ /**
+ * Sets periods contained in the charging profile are relative to this point in time.
+ *
+ * @param timeBase Periods contained in the charging profile are relative to this point in time
+ */
+ public void setTimeBase(ZonedDateTime timeBase) {
+ if (!isValidTimeBase(timeBase)) {
+ throw new PropertyConstraintException(timeBase, "timeBase is invalid");
+ }
+ this.timeBase = timeBase;
+ }
+
+ /**
+ * Returns whether the given timeBase is valid
+ *
+ * @param timeBase the timeBase to check the validity of
+ * @return {@code true} if timeBase is valid, {@code false} if not
+ */
+ private boolean isValidTimeBase(ZonedDateTime timeBase) {
+ return timeBase != null;
+ }
+
+ /**
+ * Gets charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile.
+ *
+ * @return Charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile
+ */
+ public ChargingSchedule getChargingSchedule() {
+ return chargingSchedule;
+ }
+
+ /**
+ * Sets charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile.
+ *
+ * @param chargingSchedule Charging schedule structure defines a list of charging periods, as used
+ * in: GetCompositeSchedule.conf and ChargingProfile
+ */
+ public void setChargingSchedule(ChargingSchedule chargingSchedule) {
+ if (!isValidChargingSchedule(chargingSchedule)) {
+ throw new PropertyConstraintException(chargingSchedule, "chargingSchedule is invalid");
+ }
+ this.chargingSchedule = chargingSchedule;
+ }
+
+ /**
+ * Returns whether the given chargingSchedule is valid
+ *
+ * @param chargingSchedule the chargingSchedule to check the validity of
+ * @return {@code true} if chargingSchedule is valid, {@code false} if not
+ */
+ private boolean isValidChargingSchedule(ChargingSchedule chargingSchedule) {
+ return chargingSchedule != null && chargingSchedule.validate();
+ }
+
+ /**
+ * Gets the charging schedule contained in this notification applies to an EVSE. EvseId must be
+ * greater than 0.
+ *
+ * @return The charging schedule contained in this notification applies to an EVSE
+ */
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets the charging schedule contained in this notification applies to an EVSE. EvseId must be
+ * greater than 0.
+ *
+ * @param evseId The charging schedule contained in this notification applies to an EVSE
+ */
+ public void setEvseId(Integer evseId) {
+ if (!isValidEvseId(evseId)) {
+ throw new PropertyConstraintException(evseId, "evseId is invalid");
+ }
+ this.evseId = evseId;
+ }
+
+ /**
+ * Returns whether the given evseId is valid
+ *
+ * @param evseId the evseId to check the validity of
+ * @return {@code true} if evseId is valid, {@code false} if not
+ */
+ private boolean isValidEvseId(Integer evseId) {
+ return evseId != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidTimeBase(timeBase)
+ && isValidChargingSchedule(chargingSchedule)
+ && isValidEvseId(evseId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyEVChargingScheduleRequest that = (NotifyEVChargingScheduleRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(timeBase, that.timeBase)
+ && Objects.equals(chargingSchedule, that.chargingSchedule)
+ && Objects.equals(evseId, that.evseId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, timeBase, chargingSchedule, evseId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("timeBase", timeBase)
+ .add("chargingSchedule", chargingSchedule)
+ .add("evseId", evseId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEVChargingScheduleResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEVChargingScheduleResponse.java
new file mode 100644
index 000000000..8be818fc5
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEVChargingScheduleResponse.java
@@ -0,0 +1,216 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GenericStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyEVChargingScheduleResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyEVChargingScheduleResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Returns whether the CSMS has been able to process the message successfully. It does not imply
+ * any approval of the charging schedule.
+ */
+ private GenericStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the NotifyEVChargingScheduleResponse class
+ *
+ * @param status Returns whether the CSMS has been able to process the message successfully. It
+ * does not imply any approval of the charging schedule.
+ */
+ public NotifyEVChargingScheduleResponse(GenericStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyEVChargingScheduleResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets returns whether the CSMS has been able to process the message successfully. It does not
+ * imply any approval of the charging schedule.
+ *
+ * @return Returns whether the CSMS has been able to process the message successfully
+ */
+ public GenericStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets returns whether the CSMS has been able to process the message successfully. It does not
+ * imply any approval of the charging schedule.
+ *
+ * @param status Returns whether the CSMS has been able to process the message successfully
+ */
+ public void setStatus(GenericStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GenericStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public NotifyEVChargingScheduleResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyEVChargingScheduleResponse that = (NotifyEVChargingScheduleResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEventRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEventRequest.java
new file mode 100644
index 000000000..b8b4e9934
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEventRequest.java
@@ -0,0 +1,289 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.EventData;
+import java.time.ZonedDateTime;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyEventRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyEventRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Timestamp of the moment this message was generated at the Charging Station. */
+ private ZonedDateTime generatedAt;
+
+ /**
+ * âto be continuedâ indicator. Indicates whether another part of the report follows in an
+ * upcoming notifyEventRequest message. Default value when omitted is false.
+ */
+ @Nullable private Boolean tbc;
+
+ /** Sequence number of this message. First message starts at 0. */
+ private Integer seqNo;
+
+ /** Class to report an event notification for a component-variable. */
+ private EventData[] eventData;
+
+ /**
+ * Constructor for the NotifyEventRequest class
+ *
+ * @param generatedAt Timestamp of the moment this message was generated at the Charging Station.
+ * @param seqNo Sequence number of this message. First message starts at 0.
+ * @param eventData Class to report an event notification for a component-variable.
+ */
+ public NotifyEventRequest(ZonedDateTime generatedAt, Integer seqNo, EventData[] eventData) {
+ setGeneratedAt(generatedAt);
+ setSeqNo(seqNo);
+ setEventData(eventData);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyEventRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets timestamp of the moment this message was generated at the Charging Station.
+ *
+ * @return Timestamp of the moment this message was generated at the Charging Station
+ */
+ public ZonedDateTime getGeneratedAt() {
+ return generatedAt;
+ }
+
+ /**
+ * Sets timestamp of the moment this message was generated at the Charging Station.
+ *
+ * @param generatedAt Timestamp of the moment this message was generated at the Charging Station
+ */
+ public void setGeneratedAt(ZonedDateTime generatedAt) {
+ if (!isValidGeneratedAt(generatedAt)) {
+ throw new PropertyConstraintException(generatedAt, "generatedAt is invalid");
+ }
+ this.generatedAt = generatedAt;
+ }
+
+ /**
+ * Returns whether the given generatedAt is valid
+ *
+ * @param generatedAt the generatedAt to check the validity of
+ * @return {@code true} if generatedAt is valid, {@code false} if not
+ */
+ private boolean isValidGeneratedAt(ZonedDateTime generatedAt) {
+ return generatedAt != null;
+ }
+
+ /**
+ * Gets âto be continuedâ indicator. Indicates whether another part of the report follows in an
+ * upcoming notifyEventRequest message. Default value when omitted is false.
+ *
+ * @return âto be continuedâ indicator
+ */
+ public Boolean getTbc() {
+ return tbc != null ? tbc : false;
+ }
+
+ /**
+ * Sets âto be continuedâ indicator. Indicates whether another part of the report follows in an
+ * upcoming notifyEventRequest message. Default value when omitted is false.
+ *
+ * @param tbc âto be continuedâ indicator
+ */
+ public void setTbc(@Nullable Boolean tbc) {
+ this.tbc = tbc;
+ }
+
+ /**
+ * Adds âto be continuedâ indicator. Indicates whether another part of the report follows in an
+ * upcoming notifyEventRequest message. Default value when omitted is false.
+ *
+ * @param tbc âto be continuedâ indicator
+ * @return this
+ */
+ public NotifyEventRequest withTbc(@Nullable Boolean tbc) {
+ setTbc(tbc);
+ return this;
+ }
+
+ /**
+ * Gets sequence number of this message. First message starts at 0.
+ *
+ * @return Sequence number of this message
+ */
+ public Integer getSeqNo() {
+ return seqNo;
+ }
+
+ /**
+ * Sets sequence number of this message. First message starts at 0.
+ *
+ * @param seqNo Sequence number of this message
+ */
+ public void setSeqNo(Integer seqNo) {
+ if (!isValidSeqNo(seqNo)) {
+ throw new PropertyConstraintException(seqNo, "seqNo is invalid");
+ }
+ this.seqNo = seqNo;
+ }
+
+ /**
+ * Returns whether the given seqNo is valid
+ *
+ * @param seqNo the seqNo to check the validity of
+ * @return {@code true} if seqNo is valid, {@code false} if not
+ */
+ private boolean isValidSeqNo(Integer seqNo) {
+ return seqNo != null;
+ }
+
+ /**
+ * Gets class to report an event notification for a component-variable.
+ *
+ * @return Class to report an event notification for a component-variable
+ */
+ public EventData[] getEventData() {
+ return eventData;
+ }
+
+ /**
+ * Sets class to report an event notification for a component-variable.
+ *
+ * @param eventData Class to report an event notification for a component-variable
+ */
+ public void setEventData(EventData[] eventData) {
+ if (!isValidEventData(eventData)) {
+ throw new PropertyConstraintException(eventData, "eventData is invalid");
+ }
+ this.eventData = eventData;
+ }
+
+ /**
+ * Returns whether the given eventData is valid
+ *
+ * @param eventData the eventData to check the validity of
+ * @return {@code true} if eventData is valid, {@code false} if not
+ */
+ private boolean isValidEventData(EventData[] eventData) {
+ return eventData != null
+ && eventData.length >= 1
+ && Arrays.stream(eventData).allMatch(item -> item.validate());
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidGeneratedAt(generatedAt)
+ && isValidSeqNo(seqNo)
+ && isValidEventData(eventData);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyEventRequest that = (NotifyEventRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(generatedAt, that.generatedAt)
+ && Objects.equals(tbc, that.tbc)
+ && Objects.equals(seqNo, that.seqNo)
+ && Arrays.equals(eventData, that.eventData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, generatedAt, tbc, seqNo, Arrays.hashCode(eventData));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("generatedAt", generatedAt)
+ .add("tbc", tbc)
+ .add("seqNo", seqNo)
+ .add("eventData", eventData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEventResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEventResponse.java
new file mode 100644
index 000000000..e2de921da
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyEventResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyEventResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyEventResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the NotifyEventResponse class */
+ public NotifyEventResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyEventResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyEventResponse that = (NotifyEventResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyMonitoringReportRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyMonitoringReportRequest.java
new file mode 100644
index 000000000..192fa30d3
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyMonitoringReportRequest.java
@@ -0,0 +1,338 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.MonitoringData;
+import java.time.ZonedDateTime;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyMonitoringReportRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyMonitoringReportRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Class to hold parameters of SetVariableMonitoring request. */
+ @Nullable private MonitoringData[] monitor;
+
+ /** The id of the GetMonitoringRequest that requested this report. */
+ private Integer requestId;
+
+ /**
+ * âto be continuedâ indicator. Indicates whether another part of the monitoringData follows in an
+ * upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
+ */
+ @Nullable private Boolean tbc;
+
+ /** Sequence number of this message. First message starts at 0. */
+ private Integer seqNo;
+
+ /** Timestamp of the moment this message was generated at the Charging Station. */
+ private ZonedDateTime generatedAt;
+
+ /**
+ * Constructor for the NotifyMonitoringReportRequest class
+ *
+ * @param requestId The id of the GetMonitoringRequest that requested this report.
+ * @param seqNo Sequence number of this message. First message starts at 0.
+ * @param generatedAt Timestamp of the moment this message was generated at the Charging Station.
+ */
+ public NotifyMonitoringReportRequest(
+ Integer requestId, Integer seqNo, ZonedDateTime generatedAt) {
+ setRequestId(requestId);
+ setSeqNo(seqNo);
+ setGeneratedAt(generatedAt);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyMonitoringReportRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets class to hold parameters of SetVariableMonitoring request.
+ *
+ * @return Class to hold parameters of SetVariableMonitoring request
+ */
+ @Nullable
+ public MonitoringData[] getMonitor() {
+ return monitor;
+ }
+
+ /**
+ * Sets class to hold parameters of SetVariableMonitoring request.
+ *
+ * @param monitor Class to hold parameters of SetVariableMonitoring request
+ */
+ public void setMonitor(@Nullable MonitoringData[] monitor) {
+ if (!isValidMonitor(monitor)) {
+ throw new PropertyConstraintException(monitor, "monitor is invalid");
+ }
+ this.monitor = monitor;
+ }
+
+ /**
+ * Returns whether the given monitor is valid
+ *
+ * @param monitor the monitor to check the validity of
+ * @return {@code true} if monitor is valid, {@code false} if not
+ */
+ private boolean isValidMonitor(@Nullable MonitoringData[] monitor) {
+ return monitor == null
+ || (monitor.length >= 1 && Arrays.stream(monitor).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds class to hold parameters of SetVariableMonitoring request.
+ *
+ * @param monitor Class to hold parameters of SetVariableMonitoring request
+ * @return this
+ */
+ public NotifyMonitoringReportRequest withMonitor(@Nullable MonitoringData[] monitor) {
+ setMonitor(monitor);
+ return this;
+ }
+
+ /**
+ * Gets the id of the GetMonitoringRequest that requested this report.
+ *
+ * @return The id of the GetMonitoringRequest that requested this report
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the id of the GetMonitoringRequest that requested this report.
+ *
+ * @param requestId The id of the GetMonitoringRequest that requested this report
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets âto be continuedâ indicator. Indicates whether another part of the monitoringData follows
+ * in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
+ *
+ * @return âto be continuedâ indicator
+ */
+ public Boolean getTbc() {
+ return tbc != null ? tbc : false;
+ }
+
+ /**
+ * Sets âto be continuedâ indicator. Indicates whether another part of the monitoringData follows
+ * in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
+ *
+ * @param tbc âto be continuedâ indicator
+ */
+ public void setTbc(@Nullable Boolean tbc) {
+ this.tbc = tbc;
+ }
+
+ /**
+ * Adds âto be continuedâ indicator. Indicates whether another part of the monitoringData follows
+ * in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
+ *
+ * @param tbc âto be continuedâ indicator
+ * @return this
+ */
+ public NotifyMonitoringReportRequest withTbc(@Nullable Boolean tbc) {
+ setTbc(tbc);
+ return this;
+ }
+
+ /**
+ * Gets sequence number of this message. First message starts at 0.
+ *
+ * @return Sequence number of this message
+ */
+ public Integer getSeqNo() {
+ return seqNo;
+ }
+
+ /**
+ * Sets sequence number of this message. First message starts at 0.
+ *
+ * @param seqNo Sequence number of this message
+ */
+ public void setSeqNo(Integer seqNo) {
+ if (!isValidSeqNo(seqNo)) {
+ throw new PropertyConstraintException(seqNo, "seqNo is invalid");
+ }
+ this.seqNo = seqNo;
+ }
+
+ /**
+ * Returns whether the given seqNo is valid
+ *
+ * @param seqNo the seqNo to check the validity of
+ * @return {@code true} if seqNo is valid, {@code false} if not
+ */
+ private boolean isValidSeqNo(Integer seqNo) {
+ return seqNo != null;
+ }
+
+ /**
+ * Gets timestamp of the moment this message was generated at the Charging Station.
+ *
+ * @return Timestamp of the moment this message was generated at the Charging Station
+ */
+ public ZonedDateTime getGeneratedAt() {
+ return generatedAt;
+ }
+
+ /**
+ * Sets timestamp of the moment this message was generated at the Charging Station.
+ *
+ * @param generatedAt Timestamp of the moment this message was generated at the Charging Station
+ */
+ public void setGeneratedAt(ZonedDateTime generatedAt) {
+ if (!isValidGeneratedAt(generatedAt)) {
+ throw new PropertyConstraintException(generatedAt, "generatedAt is invalid");
+ }
+ this.generatedAt = generatedAt;
+ }
+
+ /**
+ * Returns whether the given generatedAt is valid
+ *
+ * @param generatedAt the generatedAt to check the validity of
+ * @return {@code true} if generatedAt is valid, {@code false} if not
+ */
+ private boolean isValidGeneratedAt(ZonedDateTime generatedAt) {
+ return generatedAt != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidMonitor(monitor)
+ && isValidRequestId(requestId)
+ && isValidSeqNo(seqNo)
+ && isValidGeneratedAt(generatedAt);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyMonitoringReportRequest that = (NotifyMonitoringReportRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(monitor, that.monitor)
+ && Objects.equals(requestId, that.requestId)
+ && Objects.equals(tbc, that.tbc)
+ && Objects.equals(seqNo, that.seqNo)
+ && Objects.equals(generatedAt, that.generatedAt);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(monitor), requestId, tbc, seqNo, generatedAt);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("monitor", monitor)
+ .add("requestId", requestId)
+ .add("tbc", tbc)
+ .add("seqNo", seqNo)
+ .add("generatedAt", generatedAt)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyMonitoringReportResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyMonitoringReportResponse.java
new file mode 100644
index 000000000..90325f8d1
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyMonitoringReportResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyMonitoringReportResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyMonitoringReportResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the NotifyMonitoringReportResponse class */
+ public NotifyMonitoringReportResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyMonitoringReportResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyMonitoringReportResponse that = (NotifyMonitoringReportResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyReportRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyReportRequest.java
new file mode 100644
index 000000000..86f396848
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyReportRequest.java
@@ -0,0 +1,342 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.ReportData;
+import java.time.ZonedDateTime;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyReportRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyReportRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The id of the GetReportRequest or GetBaseReportRequest that requested this report */
+ private Integer requestId;
+
+ /** Timestamp of the moment this message was generated at the Charging Station. */
+ private ZonedDateTime generatedAt;
+
+ /** Class to report components, variables and variable attributes and characteristics. */
+ @Nullable private ReportData[] reportData;
+
+ /**
+ * âto be continuedâ indicator. Indicates whether another part of the report follows in an
+ * upcoming notifyReportRequest message. Default value when omitted is false.
+ */
+ @Nullable private Boolean tbc;
+
+ /** Sequence number of this message. First message starts at 0. */
+ private Integer seqNo;
+
+ /**
+ * Constructor for the NotifyReportRequest class
+ *
+ * @param requestId The id of the GetReportRequest or GetBaseReportRequest that requested this
+ * report
+ * @param generatedAt Timestamp of the moment this message was generated at the Charging Station.
+ * @param seqNo Sequence number of this message. First message starts at 0.
+ */
+ public NotifyReportRequest(Integer requestId, ZonedDateTime generatedAt, Integer seqNo) {
+ setRequestId(requestId);
+ setGeneratedAt(generatedAt);
+ setSeqNo(seqNo);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyReportRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the id of the GetReportRequest or GetBaseReportRequest that requested this report
+ *
+ * @return The id of the GetReportRequest or GetBaseReportRequest that requested this report
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the id of the GetReportRequest or GetBaseReportRequest that requested this report
+ *
+ * @param requestId The id of the GetReportRequest or GetBaseReportRequest that requested this
+ * report
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets timestamp of the moment this message was generated at the Charging Station.
+ *
+ * @return Timestamp of the moment this message was generated at the Charging Station
+ */
+ public ZonedDateTime getGeneratedAt() {
+ return generatedAt;
+ }
+
+ /**
+ * Sets timestamp of the moment this message was generated at the Charging Station.
+ *
+ * @param generatedAt Timestamp of the moment this message was generated at the Charging Station
+ */
+ public void setGeneratedAt(ZonedDateTime generatedAt) {
+ if (!isValidGeneratedAt(generatedAt)) {
+ throw new PropertyConstraintException(generatedAt, "generatedAt is invalid");
+ }
+ this.generatedAt = generatedAt;
+ }
+
+ /**
+ * Returns whether the given generatedAt is valid
+ *
+ * @param generatedAt the generatedAt to check the validity of
+ * @return {@code true} if generatedAt is valid, {@code false} if not
+ */
+ private boolean isValidGeneratedAt(ZonedDateTime generatedAt) {
+ return generatedAt != null;
+ }
+
+ /**
+ * Gets class to report components, variables and variable attributes and characteristics.
+ *
+ * @return Class to report components, variables and variable attributes and characteristics
+ */
+ @Nullable
+ public ReportData[] getReportData() {
+ return reportData;
+ }
+
+ /**
+ * Sets class to report components, variables and variable attributes and characteristics.
+ *
+ * @param reportData Class to report components, variables and variable attributes and
+ * characteristics
+ */
+ public void setReportData(@Nullable ReportData[] reportData) {
+ if (!isValidReportData(reportData)) {
+ throw new PropertyConstraintException(reportData, "reportData is invalid");
+ }
+ this.reportData = reportData;
+ }
+
+ /**
+ * Returns whether the given reportData is valid
+ *
+ * @param reportData the reportData to check the validity of
+ * @return {@code true} if reportData is valid, {@code false} if not
+ */
+ private boolean isValidReportData(@Nullable ReportData[] reportData) {
+ return reportData == null
+ || (reportData.length >= 1 && Arrays.stream(reportData).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds class to report components, variables and variable attributes and characteristics.
+ *
+ * @param reportData Class to report components, variables and variable attributes and
+ * characteristics
+ * @return this
+ */
+ public NotifyReportRequest withReportData(@Nullable ReportData[] reportData) {
+ setReportData(reportData);
+ return this;
+ }
+
+ /**
+ * Gets âto be continuedâ indicator. Indicates whether another part of the report follows in an
+ * upcoming notifyReportRequest message. Default value when omitted is false.
+ *
+ * @return âto be continuedâ indicator
+ */
+ public Boolean getTbc() {
+ return tbc != null ? tbc : false;
+ }
+
+ /**
+ * Sets âto be continuedâ indicator. Indicates whether another part of the report follows in an
+ * upcoming notifyReportRequest message. Default value when omitted is false.
+ *
+ * @param tbc âto be continuedâ indicator
+ */
+ public void setTbc(@Nullable Boolean tbc) {
+ this.tbc = tbc;
+ }
+
+ /**
+ * Adds âto be continuedâ indicator. Indicates whether another part of the report follows in an
+ * upcoming notifyReportRequest message. Default value when omitted is false.
+ *
+ * @param tbc âto be continuedâ indicator
+ * @return this
+ */
+ public NotifyReportRequest withTbc(@Nullable Boolean tbc) {
+ setTbc(tbc);
+ return this;
+ }
+
+ /**
+ * Gets sequence number of this message. First message starts at 0.
+ *
+ * @return Sequence number of this message
+ */
+ public Integer getSeqNo() {
+ return seqNo;
+ }
+
+ /**
+ * Sets sequence number of this message. First message starts at 0.
+ *
+ * @param seqNo Sequence number of this message
+ */
+ public void setSeqNo(Integer seqNo) {
+ if (!isValidSeqNo(seqNo)) {
+ throw new PropertyConstraintException(seqNo, "seqNo is invalid");
+ }
+ this.seqNo = seqNo;
+ }
+
+ /**
+ * Returns whether the given seqNo is valid
+ *
+ * @param seqNo the seqNo to check the validity of
+ * @return {@code true} if seqNo is valid, {@code false} if not
+ */
+ private boolean isValidSeqNo(Integer seqNo) {
+ return seqNo != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidRequestId(requestId)
+ && isValidGeneratedAt(generatedAt)
+ && isValidReportData(reportData)
+ && isValidSeqNo(seqNo);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyReportRequest that = (NotifyReportRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(requestId, that.requestId)
+ && Objects.equals(generatedAt, that.generatedAt)
+ && Arrays.equals(reportData, that.reportData)
+ && Objects.equals(tbc, that.tbc)
+ && Objects.equals(seqNo, that.seqNo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, requestId, generatedAt, Arrays.hashCode(reportData), tbc, seqNo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("requestId", requestId)
+ .add("generatedAt", generatedAt)
+ .add("reportData", reportData)
+ .add("tbc", tbc)
+ .add("seqNo", seqNo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyReportResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyReportResponse.java
new file mode 100644
index 000000000..7538a41da
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/NotifyReportResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * NotifyReportResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class NotifyReportResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the NotifyReportResponse class */
+ public NotifyReportResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NotifyReportResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NotifyReportResponse that = (NotifyReportResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/PublishFirmwareRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/PublishFirmwareRequest.java
new file mode 100644
index 000000000..03655c7f4
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/PublishFirmwareRequest.java
@@ -0,0 +1,336 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * PublishFirmwareRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class PublishFirmwareRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** A string containing a URI pointing to a location from which to retrieve the firmware. */
+ private String location;
+
+ /**
+ * How many times Charging Station must try to download the firmware before giving up. If this
+ * field is not present, it is left to Charging Station to decide how many times it wants to
+ * retry.
+ */
+ @Nullable private Integer retries;
+
+ /** The MD5 checksum over the entire firmware file as a hexadecimal string of length 32. */
+ private String checksum;
+
+ /** The Id of the request. */
+ private Integer requestId;
+
+ /**
+ * The interval in seconds after which a retry may be attempted. If this field is not present, it
+ * is left to Charging Station to decide how long to wait between attempts.
+ */
+ @Nullable private Integer retryInterval;
+
+ /**
+ * Constructor for the PublishFirmwareRequest class
+ *
+ * @param location A string containing a URI pointing to a location from which to retrieve the
+ * firmware.
+ * @param checksum The MD5 checksum over the entire firmware file as a hexadecimal string of
+ * length 32.
+ * @param requestId The Id of the request.
+ */
+ public PublishFirmwareRequest(String location, String checksum, Integer requestId) {
+ setLocation(location);
+ setChecksum(checksum);
+ setRequestId(requestId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public PublishFirmwareRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets a string containing a URI pointing to a location from which to retrieve the firmware.
+ *
+ * @return A string containing a URI pointing to a location from which to retrieve the firmware
+ */
+ public String getLocation() {
+ return location;
+ }
+
+ /**
+ * Sets a string containing a URI pointing to a location from which to retrieve the firmware.
+ *
+ * @param location A string containing a URI pointing to a location from which to retrieve the
+ * firmware
+ */
+ public void setLocation(String location) {
+ if (!isValidLocation(location)) {
+ throw new PropertyConstraintException(location, "location is invalid");
+ }
+ this.location = location;
+ }
+
+ /**
+ * Returns whether the given location is valid
+ *
+ * @param location the location to check the validity of
+ * @return {@code true} if location is valid, {@code false} if not
+ */
+ private boolean isValidLocation(String location) {
+ return location != null && location.length() <= 512;
+ }
+
+ /**
+ * Gets how many times Charging Station must try to download the firmware before giving up. If
+ * this field is not present, it is left to Charging Station to decide how many times it wants to
+ * retry.
+ *
+ * @return How many times Charging Station must try to download the firmware before giving up
+ */
+ @Nullable
+ public Integer getRetries() {
+ return retries;
+ }
+
+ /**
+ * Sets how many times Charging Station must try to download the firmware before giving up. If
+ * this field is not present, it is left to Charging Station to decide how many times it wants to
+ * retry.
+ *
+ * @param retries How many times Charging Station must try to download the firmware before giving
+ * up
+ */
+ public void setRetries(@Nullable Integer retries) {
+ this.retries = retries;
+ }
+
+ /**
+ * Adds how many times Charging Station must try to download the firmware before giving up. If
+ * this field is not present, it is left to Charging Station to decide how many times it wants to
+ * retry.
+ *
+ * @param retries How many times Charging Station must try to download the firmware before giving
+ * up
+ * @return this
+ */
+ public PublishFirmwareRequest withRetries(@Nullable Integer retries) {
+ setRetries(retries);
+ return this;
+ }
+
+ /**
+ * Gets the MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
+ *
+ * @return The MD5 checksum over the entire firmware file as a hexadecimal string of length 32
+ */
+ public String getChecksum() {
+ return checksum;
+ }
+
+ /**
+ * Sets the MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
+ *
+ * @param checksum The MD5 checksum over the entire firmware file as a hexadecimal string of
+ * length 32
+ */
+ public void setChecksum(String checksum) {
+ if (!isValidChecksum(checksum)) {
+ throw new PropertyConstraintException(checksum, "checksum is invalid");
+ }
+ this.checksum = checksum;
+ }
+
+ /**
+ * Returns whether the given checksum is valid
+ *
+ * @param checksum the checksum to check the validity of
+ * @return {@code true} if checksum is valid, {@code false} if not
+ */
+ private boolean isValidChecksum(String checksum) {
+ return checksum != null && checksum.length() <= 32;
+ }
+
+ /**
+ * Gets the Id of the request.
+ *
+ * @return The Id of the request
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the Id of the request.
+ *
+ * @param requestId The Id of the request
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets the interval in seconds after which a retry may be attempted. If this field is not
+ * present, it is left to Charging Station to decide how long to wait between attempts.
+ *
+ * @return The interval in seconds after which a retry may be attempted
+ */
+ @Nullable
+ public Integer getRetryInterval() {
+ return retryInterval;
+ }
+
+ /**
+ * Sets the interval in seconds after which a retry may be attempted. If this field is not
+ * present, it is left to Charging Station to decide how long to wait between attempts.
+ *
+ * @param retryInterval The interval in seconds after which a retry may be attempted
+ */
+ public void setRetryInterval(@Nullable Integer retryInterval) {
+ this.retryInterval = retryInterval;
+ }
+
+ /**
+ * Adds the interval in seconds after which a retry may be attempted. If this field is not
+ * present, it is left to Charging Station to decide how long to wait between attempts.
+ *
+ * @param retryInterval The interval in seconds after which a retry may be attempted
+ * @return this
+ */
+ public PublishFirmwareRequest withRetryInterval(@Nullable Integer retryInterval) {
+ setRetryInterval(retryInterval);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidLocation(location)
+ && isValidChecksum(checksum)
+ && isValidRequestId(requestId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ PublishFirmwareRequest that = (PublishFirmwareRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(location, that.location)
+ && Objects.equals(retries, that.retries)
+ && Objects.equals(checksum, that.checksum)
+ && Objects.equals(requestId, that.requestId)
+ && Objects.equals(retryInterval, that.retryInterval);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, location, retries, checksum, requestId, retryInterval);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("location", location)
+ .add("retries", retries)
+ .add("checksum", checksum)
+ .add("requestId", requestId)
+ .add("retryInterval", retryInterval)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/PublishFirmwareResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/PublishFirmwareResponse.java
new file mode 100644
index 000000000..9d85a8e26
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/PublishFirmwareResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GenericStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * PublishFirmwareResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class PublishFirmwareResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the request was accepted. */
+ private GenericStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the PublishFirmwareResponse class
+ *
+ * @param status Whether the request was accepted.
+ */
+ public PublishFirmwareResponse(GenericStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public PublishFirmwareResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the request was accepted.
+ *
+ * @return Whether the request was accepted
+ */
+ public GenericStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the request was accepted.
+ *
+ * @param status Whether the request was accepted
+ */
+ public void setStatus(GenericStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GenericStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public PublishFirmwareResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ PublishFirmwareResponse that = (PublishFirmwareResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/PublishFirmwareStatusNotificationRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/PublishFirmwareStatusNotificationRequest.java
new file mode 100644
index 000000000..24f79aa94
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/PublishFirmwareStatusNotificationRequest.java
@@ -0,0 +1,263 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.PublishFirmwareStatusEnum;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * PublishFirmwareStatusNotificationRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class PublishFirmwareStatusNotificationRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The progress status of the publishfirmware installation. */
+ private PublishFirmwareStatusEnum status;
+
+ /**
+ * Required if status is Published. Can be multiple URIâs, if the Local Controller supports e.g.
+ * HTTP, HTTPS, and FTP.
+ */
+ @Nullable private String[] location;
+
+ /** The request id that was provided in the PublishFirmwareRequest which triggered this action. */
+ @Nullable private Integer requestId;
+
+ /**
+ * Constructor for the PublishFirmwareStatusNotificationRequest class
+ *
+ * @param status The progress status of the publishfirmware installation.
+ */
+ public PublishFirmwareStatusNotificationRequest(PublishFirmwareStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public PublishFirmwareStatusNotificationRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the progress status of the publishfirmware installation.
+ *
+ * @return The progress status of the publishfirmware installation
+ */
+ public PublishFirmwareStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the progress status of the publishfirmware installation.
+ *
+ * @param status The progress status of the publishfirmware installation
+ */
+ public void setStatus(PublishFirmwareStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(PublishFirmwareStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets required if status is Published. Can be multiple URIâs, if the Local Controller supports
+ * e.g. HTTP, HTTPS, and FTP.
+ *
+ * @return Required if status is Published
+ */
+ @Nullable
+ public String[] getLocation() {
+ return location;
+ }
+
+ /**
+ * Sets required if status is Published. Can be multiple URIâs, if the Local Controller supports
+ * e.g. HTTP, HTTPS, and FTP.
+ *
+ * @param location Required if status is Published
+ */
+ public void setLocation(@Nullable String[] location) {
+ if (!isValidLocation(location)) {
+ throw new PropertyConstraintException(location, "location is invalid");
+ }
+ this.location = location;
+ }
+
+ /**
+ * Returns whether the given location is valid
+ *
+ * @param location the location to check the validity of
+ * @return {@code true} if location is valid, {@code false} if not
+ */
+ private boolean isValidLocation(@Nullable String[] location) {
+ return location == null
+ || (location.length >= 1 && Arrays.stream(location).allMatch(item -> item.length() <= 512));
+ }
+
+ /**
+ * Adds required if status is Published. Can be multiple URIâs, if the Local Controller supports
+ * e.g. HTTP, HTTPS, and FTP.
+ *
+ * @param location Required if status is Published
+ * @return this
+ */
+ public PublishFirmwareStatusNotificationRequest withLocation(@Nullable String[] location) {
+ setLocation(location);
+ return this;
+ }
+
+ /**
+ * Gets the request id that was provided in the PublishFirmwareRequest which triggered this
+ * action.
+ *
+ * @return The request id that was provided in the PublishFirmwareRequest which triggered this
+ * action
+ */
+ @Nullable
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the request id that was provided in the PublishFirmwareRequest which triggered this
+ * action.
+ *
+ * @param requestId The request id that was provided in the PublishFirmwareRequest which triggered
+ * this action
+ */
+ public void setRequestId(@Nullable Integer requestId) {
+ this.requestId = requestId;
+ }
+
+ /**
+ * Adds the request id that was provided in the PublishFirmwareRequest which triggered this
+ * action.
+ *
+ * @param requestId The request id that was provided in the PublishFirmwareRequest which triggered
+ * this action
+ * @return this
+ */
+ public PublishFirmwareStatusNotificationRequest withRequestId(@Nullable Integer requestId) {
+ setRequestId(requestId);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidLocation(location);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ PublishFirmwareStatusNotificationRequest that = (PublishFirmwareStatusNotificationRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Arrays.equals(location, that.location)
+ && Objects.equals(requestId, that.requestId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, Arrays.hashCode(location), requestId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("location", location)
+ .add("requestId", requestId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/PublishFirmwareStatusNotificationResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/PublishFirmwareStatusNotificationResponse.java
new file mode 100644
index 000000000..6152b6a45
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/PublishFirmwareStatusNotificationResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * PublishFirmwareStatusNotificationResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class PublishFirmwareStatusNotificationResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the PublishFirmwareStatusNotificationResponse class */
+ public PublishFirmwareStatusNotificationResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public PublishFirmwareStatusNotificationResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ PublishFirmwareStatusNotificationResponse that = (PublishFirmwareStatusNotificationResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReportChargingProfilesRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReportChargingProfilesRequest.java
new file mode 100644
index 000000000..12925f05e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReportChargingProfilesRequest.java
@@ -0,0 +1,361 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ChargingLimitSourceEnum;
+import eu.chargetime.ocpp.v201.model.types.ChargingProfile;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ReportChargingProfilesRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ReportChargingProfilesRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Id used to match the GetChargingProfilesRequest message with the resulting
+ * ReportChargingProfilesRequest messages. When the CSMS provided a requestId in the
+ * GetChargingProfilesRequest, this field SHALL contain the same value.
+ */
+ private Integer requestId;
+
+ /** Source that has installed this charging profile. */
+ private ChargingLimitSourceEnum chargingLimitSource;
+
+ /**
+ * Charging Profile
+ *
+ * A ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ */
+ private ChargingProfile[] chargingProfile;
+
+ /**
+ * To Be Continued. Default value when omitted: false. false indicates that there are no further
+ * messages as part of this report.
+ */
+ @Nullable private Boolean tbc;
+
+ /**
+ * The evse to which the charging profile applies. If evseId = 0, the message contains an overall
+ * limit for the Charging Station.
+ */
+ private Integer evseId;
+
+ /**
+ * Constructor for the ReportChargingProfilesRequest class
+ *
+ * @param requestId Id used to match the GetChargingProfilesRequest message with the resulting
+ * ReportChargingProfilesRequest messages. When the CSMS provided a requestId in the
+ * GetChargingProfilesRequest, this field SHALL contain the same value.
+ * @param chargingLimitSource Source that has installed this charging profile.
+ * @param chargingProfile A ChargingProfile consists of ChargingSchedule, describing the amount of
+ * power or current that can be delivered per time interval.
+ * @param evseId The evse to which the charging profile applies. If evseId = 0, the message
+ * contains an overall limit for the Charging Station.
+ */
+ public ReportChargingProfilesRequest(
+ Integer requestId,
+ ChargingLimitSourceEnum chargingLimitSource,
+ ChargingProfile[] chargingProfile,
+ Integer evseId) {
+ setRequestId(requestId);
+ setChargingLimitSource(chargingLimitSource);
+ setChargingProfile(chargingProfile);
+ setEvseId(evseId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ReportChargingProfilesRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets id used to match the GetChargingProfilesRequest message with the resulting
+ * ReportChargingProfilesRequest messages. When the CSMS provided a requestId in the
+ * GetChargingProfilesRequest, this field SHALL contain the same value.
+ *
+ * @return Id used to match the GetChargingProfilesRequest message with the resulting
+ * ReportChargingProfilesRequest messages
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets id used to match the GetChargingProfilesRequest message with the resulting
+ * ReportChargingProfilesRequest messages. When the CSMS provided a requestId in the
+ * GetChargingProfilesRequest, this field SHALL contain the same value.
+ *
+ * @param requestId Id used to match the GetChargingProfilesRequest message with the resulting
+ * ReportChargingProfilesRequest messages
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets source that has installed this charging profile.
+ *
+ * @return Source that has installed this charging profile
+ */
+ public ChargingLimitSourceEnum getChargingLimitSource() {
+ return chargingLimitSource;
+ }
+
+ /**
+ * Sets source that has installed this charging profile.
+ *
+ * @param chargingLimitSource Source that has installed this charging profile
+ */
+ public void setChargingLimitSource(ChargingLimitSourceEnum chargingLimitSource) {
+ if (!isValidChargingLimitSource(chargingLimitSource)) {
+ throw new PropertyConstraintException(chargingLimitSource, "chargingLimitSource is invalid");
+ }
+ this.chargingLimitSource = chargingLimitSource;
+ }
+
+ /**
+ * Returns whether the given chargingLimitSource is valid
+ *
+ * @param chargingLimitSource the chargingLimitSource to check the validity of
+ * @return {@code true} if chargingLimitSource is valid, {@code false} if not
+ */
+ private boolean isValidChargingLimitSource(ChargingLimitSourceEnum chargingLimitSource) {
+ return chargingLimitSource != null;
+ }
+
+ /**
+ * Gets a ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ *
+ * @return A ChargingProfile consists of ChargingSchedule, describing the amount of power or
+ * current that can be delivered per time interval
+ */
+ public ChargingProfile[] getChargingProfile() {
+ return chargingProfile;
+ }
+
+ /**
+ * Sets a ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ *
+ * @param chargingProfile A ChargingProfile consists of ChargingSchedule, describing the amount of
+ * power or current that can be delivered per time interval
+ */
+ public void setChargingProfile(ChargingProfile[] chargingProfile) {
+ if (!isValidChargingProfile(chargingProfile)) {
+ throw new PropertyConstraintException(chargingProfile, "chargingProfile is invalid");
+ }
+ this.chargingProfile = chargingProfile;
+ }
+
+ /**
+ * Returns whether the given chargingProfile is valid
+ *
+ * @param chargingProfile the chargingProfile to check the validity of
+ * @return {@code true} if chargingProfile is valid, {@code false} if not
+ */
+ private boolean isValidChargingProfile(ChargingProfile[] chargingProfile) {
+ return chargingProfile != null
+ && chargingProfile.length >= 1
+ && Arrays.stream(chargingProfile).allMatch(item -> item.validate());
+ }
+
+ /**
+ * Gets to Be Continued. Default value when omitted: false. false indicates that there are no
+ * further messages as part of this report.
+ *
+ * @return To Be Continued
+ */
+ public Boolean getTbc() {
+ return tbc != null ? tbc : false;
+ }
+
+ /**
+ * Sets to Be Continued. Default value when omitted: false. false indicates that there are no
+ * further messages as part of this report.
+ *
+ * @param tbc To Be Continued
+ */
+ public void setTbc(@Nullable Boolean tbc) {
+ this.tbc = tbc;
+ }
+
+ /**
+ * Adds to Be Continued. Default value when omitted: false. false indicates that there are no
+ * further messages as part of this report.
+ *
+ * @param tbc To Be Continued
+ * @return this
+ */
+ public ReportChargingProfilesRequest withTbc(@Nullable Boolean tbc) {
+ setTbc(tbc);
+ return this;
+ }
+
+ /**
+ * Gets the evse to which the charging profile applies. If evseId = 0, the message contains an
+ * overall limit for the Charging Station.
+ *
+ * @return The evse to which the charging profile applies
+ */
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets the evse to which the charging profile applies. If evseId = 0, the message contains an
+ * overall limit for the Charging Station.
+ *
+ * @param evseId The evse to which the charging profile applies
+ */
+ public void setEvseId(Integer evseId) {
+ if (!isValidEvseId(evseId)) {
+ throw new PropertyConstraintException(evseId, "evseId is invalid");
+ }
+ this.evseId = evseId;
+ }
+
+ /**
+ * Returns whether the given evseId is valid
+ *
+ * @param evseId the evseId to check the validity of
+ * @return {@code true} if evseId is valid, {@code false} if not
+ */
+ private boolean isValidEvseId(Integer evseId) {
+ return evseId != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidRequestId(requestId)
+ && isValidChargingLimitSource(chargingLimitSource)
+ && isValidChargingProfile(chargingProfile)
+ && isValidEvseId(evseId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ReportChargingProfilesRequest that = (ReportChargingProfilesRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(requestId, that.requestId)
+ && Objects.equals(chargingLimitSource, that.chargingLimitSource)
+ && Arrays.equals(chargingProfile, that.chargingProfile)
+ && Objects.equals(tbc, that.tbc)
+ && Objects.equals(evseId, that.evseId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, requestId, chargingLimitSource, Arrays.hashCode(chargingProfile), tbc, evseId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("requestId", requestId)
+ .add("chargingLimitSource", chargingLimitSource)
+ .add("chargingProfile", chargingProfile)
+ .add("tbc", tbc)
+ .add("evseId", evseId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReportChargingProfilesResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReportChargingProfilesResponse.java
new file mode 100644
index 000000000..947598a5f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReportChargingProfilesResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ReportChargingProfilesResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ReportChargingProfilesResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the ReportChargingProfilesResponse class */
+ public ReportChargingProfilesResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ReportChargingProfilesResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ReportChargingProfilesResponse that = (ReportChargingProfilesResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/RequestStartTransactionRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/RequestStartTransactionRequest.java
new file mode 100644
index 000000000..7208560d5
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/RequestStartTransactionRequest.java
@@ -0,0 +1,379 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ChargingProfile;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.IdToken;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * RequestStartTransactionRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class RequestStartTransactionRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Number of the EVSE on which to start the transaction. EvseId SHALL be greater than 0 */
+ @Nullable private Integer evseId;
+
+ /**
+ * A case insensitive identifier to use for the authorization and the type of authorization to
+ * support multiple forms of identifiers.
+ */
+ @Nullable private IdToken groupIdToken;
+
+ /**
+ * A case insensitive identifier to use for the authorization and the type of authorization to
+ * support multiple forms of identifiers.
+ */
+ private IdToken idToken;
+
+ /**
+ * Id given by the server to this start request. The Charging Station might return this in the
+ * TransactionEventRequest, letting the server know which transaction was started for this
+ * request. Use to start a transaction.
+ */
+ private Integer remoteStartId;
+
+ /**
+ * Charging Profile
+ *
+ * A ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ */
+ @Nullable private ChargingProfile chargingProfile;
+
+ /**
+ * Constructor for the RequestStartTransactionRequest class
+ *
+ * @param idToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers.
+ * @param remoteStartId Id given by the server to this start request. The Charging Station might
+ * return this in the TransactionEventRequest, letting the server know which transaction was
+ * started for this request. Use to start a transaction.
+ */
+ public RequestStartTransactionRequest(IdToken idToken, Integer remoteStartId) {
+ setIdToken(idToken);
+ setRemoteStartId(remoteStartId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public RequestStartTransactionRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets number of the EVSE on which to start the transaction. EvseId SHALL be greater than 0
+ *
+ * @return Number of the EVSE on which to start the transaction
+ */
+ @Nullable
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets number of the EVSE on which to start the transaction. EvseId SHALL be greater than 0
+ *
+ * @param evseId Number of the EVSE on which to start the transaction
+ */
+ public void setEvseId(@Nullable Integer evseId) {
+ this.evseId = evseId;
+ }
+
+ /**
+ * Adds number of the EVSE on which to start the transaction. EvseId SHALL be greater than 0
+ *
+ * @param evseId Number of the EVSE on which to start the transaction
+ * @return this
+ */
+ public RequestStartTransactionRequest withEvseId(@Nullable Integer evseId) {
+ setEvseId(evseId);
+ return this;
+ }
+
+ /**
+ * Gets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @return A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ @Nullable
+ public IdToken getGroupIdToken() {
+ return groupIdToken;
+ }
+
+ /**
+ * Sets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param groupIdToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public void setGroupIdToken(@Nullable IdToken groupIdToken) {
+ if (!isValidGroupIdToken(groupIdToken)) {
+ throw new PropertyConstraintException(groupIdToken, "groupIdToken is invalid");
+ }
+ this.groupIdToken = groupIdToken;
+ }
+
+ /**
+ * Returns whether the given groupIdToken is valid
+ *
+ * @param groupIdToken the groupIdToken to check the validity of
+ * @return {@code true} if groupIdToken is valid, {@code false} if not
+ */
+ private boolean isValidGroupIdToken(@Nullable IdToken groupIdToken) {
+ return groupIdToken == null || groupIdToken.validate();
+ }
+
+ /**
+ * Adds a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param groupIdToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ * @return this
+ */
+ public RequestStartTransactionRequest withGroupIdToken(@Nullable IdToken groupIdToken) {
+ setGroupIdToken(groupIdToken);
+ return this;
+ }
+
+ /**
+ * Gets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @return A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public IdToken getIdToken() {
+ return idToken;
+ }
+
+ /**
+ * Sets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param idToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public void setIdToken(IdToken idToken) {
+ if (!isValidIdToken(idToken)) {
+ throw new PropertyConstraintException(idToken, "idToken is invalid");
+ }
+ this.idToken = idToken;
+ }
+
+ /**
+ * Returns whether the given idToken is valid
+ *
+ * @param idToken the idToken to check the validity of
+ * @return {@code true} if idToken is valid, {@code false} if not
+ */
+ private boolean isValidIdToken(IdToken idToken) {
+ return idToken != null && idToken.validate();
+ }
+
+ /**
+ * Gets id given by the server to this start request. The Charging Station might return this in
+ * the TransactionEventRequest, letting the server know which transaction was started for this
+ * request. Use to start a transaction.
+ *
+ * @return Id given by the server to this start request
+ */
+ public Integer getRemoteStartId() {
+ return remoteStartId;
+ }
+
+ /**
+ * Sets id given by the server to this start request. The Charging Station might return this in
+ * the TransactionEventRequest, letting the server know which transaction was started for this
+ * request. Use to start a transaction.
+ *
+ * @param remoteStartId Id given by the server to this start request
+ */
+ public void setRemoteStartId(Integer remoteStartId) {
+ if (!isValidRemoteStartId(remoteStartId)) {
+ throw new PropertyConstraintException(remoteStartId, "remoteStartId is invalid");
+ }
+ this.remoteStartId = remoteStartId;
+ }
+
+ /**
+ * Returns whether the given remoteStartId is valid
+ *
+ * @param remoteStartId the remoteStartId to check the validity of
+ * @return {@code true} if remoteStartId is valid, {@code false} if not
+ */
+ private boolean isValidRemoteStartId(Integer remoteStartId) {
+ return remoteStartId != null;
+ }
+
+ /**
+ * Gets a ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ *
+ * @return A ChargingProfile consists of ChargingSchedule, describing the amount of power or
+ * current that can be delivered per time interval
+ */
+ @Nullable
+ public ChargingProfile getChargingProfile() {
+ return chargingProfile;
+ }
+
+ /**
+ * Sets a ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ *
+ * @param chargingProfile A ChargingProfile consists of ChargingSchedule, describing the amount of
+ * power or current that can be delivered per time interval
+ */
+ public void setChargingProfile(@Nullable ChargingProfile chargingProfile) {
+ if (!isValidChargingProfile(chargingProfile)) {
+ throw new PropertyConstraintException(chargingProfile, "chargingProfile is invalid");
+ }
+ this.chargingProfile = chargingProfile;
+ }
+
+ /**
+ * Returns whether the given chargingProfile is valid
+ *
+ * @param chargingProfile the chargingProfile to check the validity of
+ * @return {@code true} if chargingProfile is valid, {@code false} if not
+ */
+ private boolean isValidChargingProfile(@Nullable ChargingProfile chargingProfile) {
+ return chargingProfile == null || chargingProfile.validate();
+ }
+
+ /**
+ * Adds a ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ *
+ * @param chargingProfile A ChargingProfile consists of ChargingSchedule, describing the amount of
+ * power or current that can be delivered per time interval
+ * @return this
+ */
+ public RequestStartTransactionRequest withChargingProfile(
+ @Nullable ChargingProfile chargingProfile) {
+ setChargingProfile(chargingProfile);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidGroupIdToken(groupIdToken)
+ && isValidIdToken(idToken)
+ && isValidRemoteStartId(remoteStartId)
+ && isValidChargingProfile(chargingProfile);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ RequestStartTransactionRequest that = (RequestStartTransactionRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(evseId, that.evseId)
+ && Objects.equals(groupIdToken, that.groupIdToken)
+ && Objects.equals(idToken, that.idToken)
+ && Objects.equals(remoteStartId, that.remoteStartId)
+ && Objects.equals(chargingProfile, that.chargingProfile);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, evseId, groupIdToken, idToken, remoteStartId, chargingProfile);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("evseId", evseId)
+ .add("groupIdToken", groupIdToken)
+ .add("idToken", idToken)
+ .add("remoteStartId", remoteStartId)
+ .add("chargingProfile", chargingProfile)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/RequestStartTransactionResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/RequestStartTransactionResponse.java
new file mode 100644
index 000000000..fe9bc5bff
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/RequestStartTransactionResponse.java
@@ -0,0 +1,277 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.RequestStartStopStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * RequestStartTransactionResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class RequestStartTransactionResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Status indicating whether the Charging Station accepts the request to start a transaction. */
+ private RequestStartStopStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * When the transaction was already started by the Charging Station before the
+ * RequestStartTransactionRequest was received, for example: cable plugged in first. This contains
+ * the transactionId of the already started transaction.
+ */
+ @Nullable private String transactionId;
+
+ /**
+ * Constructor for the RequestStartTransactionResponse class
+ *
+ * @param status Status indicating whether the Charging Station accepts the request to start a
+ * transaction.
+ */
+ public RequestStartTransactionResponse(RequestStartStopStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public RequestStartTransactionResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets status indicating whether the Charging Station accepts the request to start a transaction.
+ *
+ * @return Status indicating whether the Charging Station accepts the request to start a
+ * transaction
+ */
+ public RequestStartStopStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets status indicating whether the Charging Station accepts the request to start a transaction.
+ *
+ * @param status Status indicating whether the Charging Station accepts the request to start a
+ * transaction
+ */
+ public void setStatus(RequestStartStopStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(RequestStartStopStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public RequestStartTransactionResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ /**
+ * Gets when the transaction was already started by the Charging Station before the
+ * RequestStartTransactionRequest was received, for example: cable plugged in first. This contains
+ * the transactionId of the already started transaction.
+ *
+ * @return When the transaction was already started by the Charging Station before the
+ * RequestStartTransactionRequest was received, for example: cable plugged in first
+ */
+ @Nullable
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ /**
+ * Sets when the transaction was already started by the Charging Station before the
+ * RequestStartTransactionRequest was received, for example: cable plugged in first. This contains
+ * the transactionId of the already started transaction.
+ *
+ * @param transactionId When the transaction was already started by the Charging Station before
+ * the RequestStartTransactionRequest was received, for example: cable plugged in first
+ */
+ public void setTransactionId(@Nullable String transactionId) {
+ if (!isValidTransactionId(transactionId)) {
+ throw new PropertyConstraintException(transactionId, "transactionId is invalid");
+ }
+ this.transactionId = transactionId;
+ }
+
+ /**
+ * Returns whether the given transactionId is valid
+ *
+ * @param transactionId the transactionId to check the validity of
+ * @return {@code true} if transactionId is valid, {@code false} if not
+ */
+ private boolean isValidTransactionId(@Nullable String transactionId) {
+ return transactionId == null || transactionId.length() <= 36;
+ }
+
+ /**
+ * Adds when the transaction was already started by the Charging Station before the
+ * RequestStartTransactionRequest was received, for example: cable plugged in first. This contains
+ * the transactionId of the already started transaction.
+ *
+ * @param transactionId When the transaction was already started by the Charging Station before
+ * the RequestStartTransactionRequest was received, for example: cable plugged in first
+ * @return this
+ */
+ public RequestStartTransactionResponse withTransactionId(@Nullable String transactionId) {
+ setTransactionId(transactionId);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidStatus(status)
+ && isValidStatusInfo(statusInfo)
+ && isValidTransactionId(transactionId);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ RequestStartTransactionResponse that = (RequestStartTransactionResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo)
+ && Objects.equals(transactionId, that.transactionId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo, transactionId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("transactionId", transactionId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/RequestStopTransactionRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/RequestStopTransactionRequest.java
new file mode 100644
index 000000000..40881a62f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/RequestStopTransactionRequest.java
@@ -0,0 +1,167 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * RequestStopTransactionRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class RequestStopTransactionRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The identifier of the transaction which the Charging Station is requested to stop. */
+ private String transactionId;
+
+ /**
+ * Constructor for the RequestStopTransactionRequest class
+ *
+ * @param transactionId The identifier of the transaction which the Charging Station is requested
+ * to stop.
+ */
+ public RequestStopTransactionRequest(String transactionId) {
+ setTransactionId(transactionId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public RequestStopTransactionRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the identifier of the transaction which the Charging Station is requested to stop.
+ *
+ * @return The identifier of the transaction which the Charging Station is requested to stop
+ */
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ /**
+ * Sets the identifier of the transaction which the Charging Station is requested to stop.
+ *
+ * @param transactionId The identifier of the transaction which the Charging Station is requested
+ * to stop
+ */
+ public void setTransactionId(String transactionId) {
+ if (!isValidTransactionId(transactionId)) {
+ throw new PropertyConstraintException(transactionId, "transactionId is invalid");
+ }
+ this.transactionId = transactionId;
+ }
+
+ /**
+ * Returns whether the given transactionId is valid
+ *
+ * @param transactionId the transactionId to check the validity of
+ * @return {@code true} if transactionId is valid, {@code false} if not
+ */
+ private boolean isValidTransactionId(String transactionId) {
+ return transactionId != null && transactionId.length() <= 36;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidTransactionId(transactionId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ RequestStopTransactionRequest that = (RequestStopTransactionRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(transactionId, that.transactionId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, transactionId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("transactionId", transactionId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/RequestStopTransactionResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/RequestStopTransactionResponse.java
new file mode 100644
index 000000000..a076c2eac
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/RequestStopTransactionResponse.java
@@ -0,0 +1,212 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.RequestStartStopStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * RequestStopTransactionResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class RequestStopTransactionResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Status indicating whether Charging Station accepts the request to stop a transaction. */
+ private RequestStartStopStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the RequestStopTransactionResponse class
+ *
+ * @param status Status indicating whether Charging Station accepts the request to stop a
+ * transaction.
+ */
+ public RequestStopTransactionResponse(RequestStartStopStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public RequestStopTransactionResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets status indicating whether Charging Station accepts the request to stop a transaction.
+ *
+ * @return Status indicating whether Charging Station accepts the request to stop a transaction
+ */
+ public RequestStartStopStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets status indicating whether Charging Station accepts the request to stop a transaction.
+ *
+ * @param status Status indicating whether Charging Station accepts the request to stop a
+ * transaction
+ */
+ public void setStatus(RequestStartStopStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(RequestStartStopStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public RequestStopTransactionResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ RequestStopTransactionResponse that = (RequestStopTransactionResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReservationStatusUpdateRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReservationStatusUpdateRequest.java
new file mode 100644
index 000000000..ed0b26e5d
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReservationStatusUpdateRequest.java
@@ -0,0 +1,209 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.ReservationUpdateStatusEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ReservationStatusUpdateRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ReservationStatusUpdateRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The ID of the reservation. */
+ private Integer reservationId;
+
+ /** The updated reservation status. */
+ private ReservationUpdateStatusEnum reservationUpdateStatus;
+
+ /**
+ * Constructor for the ReservationStatusUpdateRequest class
+ *
+ * @param reservationId The ID of the reservation.
+ * @param reservationUpdateStatus The updated reservation status.
+ */
+ public ReservationStatusUpdateRequest(
+ Integer reservationId, ReservationUpdateStatusEnum reservationUpdateStatus) {
+ setReservationId(reservationId);
+ setReservationUpdateStatus(reservationUpdateStatus);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ReservationStatusUpdateRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the ID of the reservation.
+ *
+ * @return The ID of the reservation
+ */
+ public Integer getReservationId() {
+ return reservationId;
+ }
+
+ /**
+ * Sets the ID of the reservation.
+ *
+ * @param reservationId The ID of the reservation
+ */
+ public void setReservationId(Integer reservationId) {
+ if (!isValidReservationId(reservationId)) {
+ throw new PropertyConstraintException(reservationId, "reservationId is invalid");
+ }
+ this.reservationId = reservationId;
+ }
+
+ /**
+ * Returns whether the given reservationId is valid
+ *
+ * @param reservationId the reservationId to check the validity of
+ * @return {@code true} if reservationId is valid, {@code false} if not
+ */
+ private boolean isValidReservationId(Integer reservationId) {
+ return reservationId != null;
+ }
+
+ /**
+ * Gets the updated reservation status.
+ *
+ * @return The updated reservation status
+ */
+ public ReservationUpdateStatusEnum getReservationUpdateStatus() {
+ return reservationUpdateStatus;
+ }
+
+ /**
+ * Sets the updated reservation status.
+ *
+ * @param reservationUpdateStatus The updated reservation status
+ */
+ public void setReservationUpdateStatus(ReservationUpdateStatusEnum reservationUpdateStatus) {
+ if (!isValidReservationUpdateStatus(reservationUpdateStatus)) {
+ throw new PropertyConstraintException(
+ reservationUpdateStatus, "reservationUpdateStatus is invalid");
+ }
+ this.reservationUpdateStatus = reservationUpdateStatus;
+ }
+
+ /**
+ * Returns whether the given reservationUpdateStatus is valid
+ *
+ * @param reservationUpdateStatus the reservationUpdateStatus to check the validity of
+ * @return {@code true} if reservationUpdateStatus is valid, {@code false} if not
+ */
+ private boolean isValidReservationUpdateStatus(
+ ReservationUpdateStatusEnum reservationUpdateStatus) {
+ return reservationUpdateStatus != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidReservationId(reservationId)
+ && isValidReservationUpdateStatus(reservationUpdateStatus);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ReservationStatusUpdateRequest that = (ReservationStatusUpdateRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(reservationId, that.reservationId)
+ && Objects.equals(reservationUpdateStatus, that.reservationUpdateStatus);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, reservationId, reservationUpdateStatus);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("reservationId", reservationId)
+ .add("reservationUpdateStatus", reservationUpdateStatus)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReservationStatusUpdateResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReservationStatusUpdateResponse.java
new file mode 100644
index 000000000..74ee84d23
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReservationStatusUpdateResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ReservationStatusUpdateResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ReservationStatusUpdateResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the ReservationStatusUpdateResponse class */
+ public ReservationStatusUpdateResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ReservationStatusUpdateResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ReservationStatusUpdateResponse that = (ReservationStatusUpdateResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReserveNowRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReserveNowRequest.java
new file mode 100644
index 000000000..63847b8e3
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReserveNowRequest.java
@@ -0,0 +1,384 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ConnectorEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.IdToken;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ReserveNowRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ReserveNowRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Id of reservation. */
+ private Integer id;
+
+ /** Date and time at which the reservation expires. */
+ private ZonedDateTime expiryDateTime;
+
+ /** The connector type. */
+ @Nullable private ConnectorEnum connectorType;
+
+ /**
+ * A case insensitive identifier to use for the authorization and the type of authorization to
+ * support multiple forms of identifiers.
+ */
+ private IdToken idToken;
+
+ /** ID of the evse to be reserved. */
+ @Nullable private Integer evseId;
+
+ /**
+ * A case insensitive identifier to use for the authorization and the type of authorization to
+ * support multiple forms of identifiers.
+ */
+ @Nullable private IdToken groupIdToken;
+
+ /**
+ * Constructor for the ReserveNowRequest class
+ *
+ * @param id Id of reservation.
+ * @param expiryDateTime Date and time at which the reservation expires.
+ * @param idToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers.
+ */
+ public ReserveNowRequest(Integer id, ZonedDateTime expiryDateTime, IdToken idToken) {
+ setId(id);
+ setExpiryDateTime(expiryDateTime);
+ setIdToken(idToken);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ReserveNowRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets id of reservation.
+ *
+ * @return Id of reservation
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * Sets id of reservation.
+ *
+ * @param id Id of reservation
+ */
+ public void setId(Integer id) {
+ if (!isValidId(id)) {
+ throw new PropertyConstraintException(id, "id is invalid");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Returns whether the given id is valid
+ *
+ * @param id the id to check the validity of
+ * @return {@code true} if id is valid, {@code false} if not
+ */
+ private boolean isValidId(Integer id) {
+ return id != null;
+ }
+
+ /**
+ * Gets date and time at which the reservation expires.
+ *
+ * @return Date and time at which the reservation expires
+ */
+ public ZonedDateTime getExpiryDateTime() {
+ return expiryDateTime;
+ }
+
+ /**
+ * Sets date and time at which the reservation expires.
+ *
+ * @param expiryDateTime Date and time at which the reservation expires
+ */
+ public void setExpiryDateTime(ZonedDateTime expiryDateTime) {
+ if (!isValidExpiryDateTime(expiryDateTime)) {
+ throw new PropertyConstraintException(expiryDateTime, "expiryDateTime is invalid");
+ }
+ this.expiryDateTime = expiryDateTime;
+ }
+
+ /**
+ * Returns whether the given expiryDateTime is valid
+ *
+ * @param expiryDateTime the expiryDateTime to check the validity of
+ * @return {@code true} if expiryDateTime is valid, {@code false} if not
+ */
+ private boolean isValidExpiryDateTime(ZonedDateTime expiryDateTime) {
+ return expiryDateTime != null;
+ }
+
+ /**
+ * Gets the connector type.
+ *
+ * @return The connector type
+ */
+ @Nullable
+ public ConnectorEnum getConnectorType() {
+ return connectorType;
+ }
+
+ /**
+ * Sets the connector type.
+ *
+ * @param connectorType The connector type
+ */
+ public void setConnectorType(@Nullable ConnectorEnum connectorType) {
+ this.connectorType = connectorType;
+ }
+
+ /**
+ * Adds the connector type.
+ *
+ * @param connectorType The connector type
+ * @return this
+ */
+ public ReserveNowRequest withConnectorType(@Nullable ConnectorEnum connectorType) {
+ setConnectorType(connectorType);
+ return this;
+ }
+
+ /**
+ * Gets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @return A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public IdToken getIdToken() {
+ return idToken;
+ }
+
+ /**
+ * Sets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param idToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public void setIdToken(IdToken idToken) {
+ if (!isValidIdToken(idToken)) {
+ throw new PropertyConstraintException(idToken, "idToken is invalid");
+ }
+ this.idToken = idToken;
+ }
+
+ /**
+ * Returns whether the given idToken is valid
+ *
+ * @param idToken the idToken to check the validity of
+ * @return {@code true} if idToken is valid, {@code false} if not
+ */
+ private boolean isValidIdToken(IdToken idToken) {
+ return idToken != null && idToken.validate();
+ }
+
+ /**
+ * Gets ID of the evse to be reserved.
+ *
+ * @return ID of the evse to be reserved
+ */
+ @Nullable
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets ID of the evse to be reserved.
+ *
+ * @param evseId ID of the evse to be reserved
+ */
+ public void setEvseId(@Nullable Integer evseId) {
+ this.evseId = evseId;
+ }
+
+ /**
+ * Adds ID of the evse to be reserved.
+ *
+ * @param evseId ID of the evse to be reserved
+ * @return this
+ */
+ public ReserveNowRequest withEvseId(@Nullable Integer evseId) {
+ setEvseId(evseId);
+ return this;
+ }
+
+ /**
+ * Gets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @return A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ @Nullable
+ public IdToken getGroupIdToken() {
+ return groupIdToken;
+ }
+
+ /**
+ * Sets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param groupIdToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public void setGroupIdToken(@Nullable IdToken groupIdToken) {
+ if (!isValidGroupIdToken(groupIdToken)) {
+ throw new PropertyConstraintException(groupIdToken, "groupIdToken is invalid");
+ }
+ this.groupIdToken = groupIdToken;
+ }
+
+ /**
+ * Returns whether the given groupIdToken is valid
+ *
+ * @param groupIdToken the groupIdToken to check the validity of
+ * @return {@code true} if groupIdToken is valid, {@code false} if not
+ */
+ private boolean isValidGroupIdToken(@Nullable IdToken groupIdToken) {
+ return groupIdToken == null || groupIdToken.validate();
+ }
+
+ /**
+ * Adds a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param groupIdToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ * @return this
+ */
+ public ReserveNowRequest withGroupIdToken(@Nullable IdToken groupIdToken) {
+ setGroupIdToken(groupIdToken);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidId(id)
+ && isValidExpiryDateTime(expiryDateTime)
+ && isValidIdToken(idToken)
+ && isValidGroupIdToken(groupIdToken);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ReserveNowRequest that = (ReserveNowRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(id, that.id)
+ && Objects.equals(expiryDateTime, that.expiryDateTime)
+ && Objects.equals(connectorType, that.connectorType)
+ && Objects.equals(idToken, that.idToken)
+ && Objects.equals(evseId, that.evseId)
+ && Objects.equals(groupIdToken, that.groupIdToken);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, id, expiryDateTime, connectorType, idToken, evseId, groupIdToken);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("id", id)
+ .add("expiryDateTime", expiryDateTime)
+ .add("connectorType", connectorType)
+ .add("idToken", idToken)
+ .add("evseId", evseId)
+ .add("groupIdToken", groupIdToken)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReserveNowResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReserveNowResponse.java
new file mode 100644
index 000000000..2f8b91210
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ReserveNowResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.ReserveNowStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ReserveNowResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ReserveNowResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The success or failure of the reservation. */
+ private ReserveNowStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the ReserveNowResponse class
+ *
+ * @param status The success or failure of the reservation.
+ */
+ public ReserveNowResponse(ReserveNowStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ReserveNowResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the success or failure of the reservation.
+ *
+ * @return The success or failure of the reservation
+ */
+ public ReserveNowStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the success or failure of the reservation.
+ *
+ * @param status The success or failure of the reservation
+ */
+ public void setStatus(ReserveNowStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(ReserveNowStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public ReserveNowResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ReserveNowResponse that = (ReserveNowResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ResetRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ResetRequest.java
new file mode 100644
index 000000000..52bcc552f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ResetRequest.java
@@ -0,0 +1,204 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.ResetEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ResetRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ResetRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The type of reset that the Charging Station or EVSE should perform. */
+ private ResetEnum type;
+
+ /** The ID of a specific EVSE that needs to be reset, instead of the entire Charging Station. */
+ @Nullable private Integer evseId;
+
+ /**
+ * Constructor for the ResetRequest class
+ *
+ * @param type The type of reset that the Charging Station or EVSE should perform.
+ */
+ public ResetRequest(ResetEnum type) {
+ setType(type);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ResetRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the type of reset that the Charging Station or EVSE should perform.
+ *
+ * @return The type of reset that the Charging Station or EVSE should perform
+ */
+ public ResetEnum getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type of reset that the Charging Station or EVSE should perform.
+ *
+ * @param type The type of reset that the Charging Station or EVSE should perform
+ */
+ public void setType(ResetEnum type) {
+ if (!isValidType(type)) {
+ throw new PropertyConstraintException(type, "type is invalid");
+ }
+ this.type = type;
+ }
+
+ /**
+ * Returns whether the given type is valid
+ *
+ * @param type the type to check the validity of
+ * @return {@code true} if type is valid, {@code false} if not
+ */
+ private boolean isValidType(ResetEnum type) {
+ return type != null;
+ }
+
+ /**
+ * Gets the ID of a specific EVSE that needs to be reset, instead of the entire Charging Station.
+ *
+ * @return The ID of a specific EVSE that needs to be reset, instead of the entire Charging
+ * Station
+ */
+ @Nullable
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets the ID of a specific EVSE that needs to be reset, instead of the entire Charging Station.
+ *
+ * @param evseId The ID of a specific EVSE that needs to be reset, instead of the entire Charging
+ * Station
+ */
+ public void setEvseId(@Nullable Integer evseId) {
+ this.evseId = evseId;
+ }
+
+ /**
+ * Adds the ID of a specific EVSE that needs to be reset, instead of the entire Charging Station.
+ *
+ * @param evseId The ID of a specific EVSE that needs to be reset, instead of the entire Charging
+ * Station
+ * @return this
+ */
+ public ResetRequest withEvseId(@Nullable Integer evseId) {
+ setEvseId(evseId);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidType(type);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ResetRequest that = (ResetRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(type, that.type)
+ && Objects.equals(evseId, that.evseId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, type, evseId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("type", type)
+ .add("evseId", evseId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ResetResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ResetResponse.java
new file mode 100644
index 000000000..c94a5f527
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/ResetResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.ResetStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ResetResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class ResetResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the Charging Station is able to perform the reset. */
+ private ResetStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the ResetResponse class
+ *
+ * @param status Whether the Charging Station is able to perform the reset.
+ */
+ public ResetResponse(ResetStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ResetResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Charging Station is able to perform the reset.
+ *
+ * @return Whether the Charging Station is able to perform the reset
+ */
+ public ResetStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station is able to perform the reset.
+ *
+ * @param status Whether the Charging Station is able to perform the reset
+ */
+ public void setStatus(ResetStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(ResetStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public ResetResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ResetResponse that = (ResetResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SecurityEventNotificationRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SecurityEventNotificationRequest.java
new file mode 100644
index 000000000..c2530000c
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SecurityEventNotificationRequest.java
@@ -0,0 +1,256 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SecurityEventNotificationRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SecurityEventNotificationRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Type of the security event. This value should be taken from the Security events list. */
+ private String type;
+
+ /** Date and time at which the event occurred. */
+ private ZonedDateTime timestamp;
+
+ /** Additional information about the occurred security event. */
+ @Nullable private String techInfo;
+
+ /**
+ * Constructor for the SecurityEventNotificationRequest class
+ *
+ * @param type Type of the security event. This value should be taken from the Security events
+ * list.
+ * @param timestamp Date and time at which the event occurred.
+ */
+ public SecurityEventNotificationRequest(String type, ZonedDateTime timestamp) {
+ setType(type);
+ setTimestamp(timestamp);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SecurityEventNotificationRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets type of the security event. This value should be taken from the Security events list.
+ *
+ * @return Type of the security event
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets type of the security event. This value should be taken from the Security events list.
+ *
+ * @param type Type of the security event
+ */
+ public void setType(String type) {
+ if (!isValidType(type)) {
+ throw new PropertyConstraintException(type, "type is invalid");
+ }
+ this.type = type;
+ }
+
+ /**
+ * Returns whether the given type is valid
+ *
+ * @param type the type to check the validity of
+ * @return {@code true} if type is valid, {@code false} if not
+ */
+ private boolean isValidType(String type) {
+ return type != null && type.length() <= 50;
+ }
+
+ /**
+ * Gets date and time at which the event occurred.
+ *
+ * @return Date and time at which the event occurred
+ */
+ public ZonedDateTime getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * Sets date and time at which the event occurred.
+ *
+ * @param timestamp Date and time at which the event occurred
+ */
+ public void setTimestamp(ZonedDateTime timestamp) {
+ if (!isValidTimestamp(timestamp)) {
+ throw new PropertyConstraintException(timestamp, "timestamp is invalid");
+ }
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * Returns whether the given timestamp is valid
+ *
+ * @param timestamp the timestamp to check the validity of
+ * @return {@code true} if timestamp is valid, {@code false} if not
+ */
+ private boolean isValidTimestamp(ZonedDateTime timestamp) {
+ return timestamp != null;
+ }
+
+ /**
+ * Gets additional information about the occurred security event.
+ *
+ * @return Additional information about the occurred security event
+ */
+ @Nullable
+ public String getTechInfo() {
+ return techInfo;
+ }
+
+ /**
+ * Sets additional information about the occurred security event.
+ *
+ * @param techInfo Additional information about the occurred security event
+ */
+ public void setTechInfo(@Nullable String techInfo) {
+ if (!isValidTechInfo(techInfo)) {
+ throw new PropertyConstraintException(techInfo, "techInfo is invalid");
+ }
+ this.techInfo = techInfo;
+ }
+
+ /**
+ * Returns whether the given techInfo is valid
+ *
+ * @param techInfo the techInfo to check the validity of
+ * @return {@code true} if techInfo is valid, {@code false} if not
+ */
+ private boolean isValidTechInfo(@Nullable String techInfo) {
+ return techInfo == null || techInfo.length() <= 255;
+ }
+
+ /**
+ * Adds additional information about the occurred security event.
+ *
+ * @param techInfo Additional information about the occurred security event
+ * @return this
+ */
+ public SecurityEventNotificationRequest withTechInfo(@Nullable String techInfo) {
+ setTechInfo(techInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidType(type)
+ && isValidTimestamp(timestamp)
+ && isValidTechInfo(techInfo);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SecurityEventNotificationRequest that = (SecurityEventNotificationRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(type, that.type)
+ && Objects.equals(timestamp, that.timestamp)
+ && Objects.equals(techInfo, that.techInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, type, timestamp, techInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("type", type)
+ .add("timestamp", timestamp)
+ .add("techInfo", techInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SecurityEventNotificationResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SecurityEventNotificationResponse.java
new file mode 100644
index 000000000..68783c70c
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SecurityEventNotificationResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SecurityEventNotificationResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SecurityEventNotificationResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the SecurityEventNotificationResponse class */
+ public SecurityEventNotificationResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SecurityEventNotificationResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SecurityEventNotificationResponse that = (SecurityEventNotificationResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SendLocalListRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SendLocalListRequest.java
new file mode 100644
index 000000000..259ae59b9
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SendLocalListRequest.java
@@ -0,0 +1,270 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.AuthorizationData;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.UpdateEnum;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SendLocalListRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SendLocalListRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The identifier to use for authorization. */
+ @Nullable private AuthorizationData[] localAuthorizationList;
+
+ /**
+ * In case of a full update this is the version number of the full list. In case of a differential
+ * update it is the version number of the list after the update has been applied.
+ */
+ private Integer versionNumber;
+
+ /** The type of update (full or differential) of this request. */
+ private UpdateEnum updateType;
+
+ /**
+ * Constructor for the SendLocalListRequest class
+ *
+ * @param versionNumber In case of a full update this is the version number of the full list. In
+ * case of a differential update it is the version number of the list after the update has
+ * been applied.
+ * @param updateType The type of update (full or differential) of this request.
+ */
+ public SendLocalListRequest(Integer versionNumber, UpdateEnum updateType) {
+ setVersionNumber(versionNumber);
+ setUpdateType(updateType);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SendLocalListRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the identifier to use for authorization.
+ *
+ * @return The identifier to use for authorization
+ */
+ @Nullable
+ public AuthorizationData[] getLocalAuthorizationList() {
+ return localAuthorizationList;
+ }
+
+ /**
+ * Sets the identifier to use for authorization.
+ *
+ * @param localAuthorizationList The identifier to use for authorization
+ */
+ public void setLocalAuthorizationList(@Nullable AuthorizationData[] localAuthorizationList) {
+ if (!isValidLocalAuthorizationList(localAuthorizationList)) {
+ throw new PropertyConstraintException(
+ localAuthorizationList, "localAuthorizationList is invalid");
+ }
+ this.localAuthorizationList = localAuthorizationList;
+ }
+
+ /**
+ * Returns whether the given localAuthorizationList is valid
+ *
+ * @param localAuthorizationList the localAuthorizationList to check the validity of
+ * @return {@code true} if localAuthorizationList is valid, {@code false} if not
+ */
+ private boolean isValidLocalAuthorizationList(
+ @Nullable AuthorizationData[] localAuthorizationList) {
+ return localAuthorizationList == null
+ || (localAuthorizationList.length >= 1
+ && Arrays.stream(localAuthorizationList).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds the identifier to use for authorization.
+ *
+ * @param localAuthorizationList The identifier to use for authorization
+ * @return this
+ */
+ public SendLocalListRequest withLocalAuthorizationList(
+ @Nullable AuthorizationData[] localAuthorizationList) {
+ setLocalAuthorizationList(localAuthorizationList);
+ return this;
+ }
+
+ /**
+ * Gets in case of a full update this is the version number of the full list. In case of a
+ * differential update it is the version number of the list after the update has been applied.
+ *
+ * @return In case of a full update this is the version number of the full list
+ */
+ public Integer getVersionNumber() {
+ return versionNumber;
+ }
+
+ /**
+ * Sets in case of a full update this is the version number of the full list. In case of a
+ * differential update it is the version number of the list after the update has been applied.
+ *
+ * @param versionNumber In case of a full update this is the version number of the full list
+ */
+ public void setVersionNumber(Integer versionNumber) {
+ if (!isValidVersionNumber(versionNumber)) {
+ throw new PropertyConstraintException(versionNumber, "versionNumber is invalid");
+ }
+ this.versionNumber = versionNumber;
+ }
+
+ /**
+ * Returns whether the given versionNumber is valid
+ *
+ * @param versionNumber the versionNumber to check the validity of
+ * @return {@code true} if versionNumber is valid, {@code false} if not
+ */
+ private boolean isValidVersionNumber(Integer versionNumber) {
+ return versionNumber != null;
+ }
+
+ /**
+ * Gets the type of update (full or differential) of this request.
+ *
+ * @return The type of update (full or differential) of this request
+ */
+ public UpdateEnum getUpdateType() {
+ return updateType;
+ }
+
+ /**
+ * Sets the type of update (full or differential) of this request.
+ *
+ * @param updateType The type of update (full or differential) of this request
+ */
+ public void setUpdateType(UpdateEnum updateType) {
+ if (!isValidUpdateType(updateType)) {
+ throw new PropertyConstraintException(updateType, "updateType is invalid");
+ }
+ this.updateType = updateType;
+ }
+
+ /**
+ * Returns whether the given updateType is valid
+ *
+ * @param updateType the updateType to check the validity of
+ * @return {@code true} if updateType is valid, {@code false} if not
+ */
+ private boolean isValidUpdateType(UpdateEnum updateType) {
+ return updateType != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidLocalAuthorizationList(localAuthorizationList)
+ && isValidVersionNumber(versionNumber)
+ && isValidUpdateType(updateType);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SendLocalListRequest that = (SendLocalListRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(localAuthorizationList, that.localAuthorizationList)
+ && Objects.equals(versionNumber, that.versionNumber)
+ && Objects.equals(updateType, that.updateType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, Arrays.hashCode(localAuthorizationList), versionNumber, updateType);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("localAuthorizationList", localAuthorizationList)
+ .add("versionNumber", versionNumber)
+ .add("updateType", updateType)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SendLocalListResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SendLocalListResponse.java
new file mode 100644
index 000000000..473026b4f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SendLocalListResponse.java
@@ -0,0 +1,218 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.SendLocalListStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SendLocalListResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SendLocalListResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Whether the Charging Station has successfully received and applied the update of the Local
+ * Authorization List.
+ */
+ private SendLocalListStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the SendLocalListResponse class
+ *
+ * @param status Whether the Charging Station has successfully received and applied the update of
+ * the Local Authorization List.
+ */
+ public SendLocalListResponse(SendLocalListStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SendLocalListResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Charging Station has successfully received and applied the update of the Local
+ * Authorization List.
+ *
+ * @return Whether the Charging Station has successfully received and applied the update of the
+ * Local Authorization List
+ */
+ public SendLocalListStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station has successfully received and applied the update of the Local
+ * Authorization List.
+ *
+ * @param status Whether the Charging Station has successfully received and applied the update of
+ * the Local Authorization List
+ */
+ public void setStatus(SendLocalListStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(SendLocalListStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public SendLocalListResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SendLocalListResponse that = (SendLocalListResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetChargingProfileRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetChargingProfileRequest.java
new file mode 100644
index 000000000..4d295863f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetChargingProfileRequest.java
@@ -0,0 +1,226 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ChargingProfile;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetChargingProfileRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetChargingProfileRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * For TxDefaultProfile an evseId=0 applies the profile to each individual evse. For
+ * ChargingStationMaxProfile and ChargingStationExternalConstraints an evseId=0 contains an overal
+ * limit for the whole Charging Station.
+ */
+ private Integer evseId;
+
+ /**
+ * Charging Profile
+ *
+ * A ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ */
+ private ChargingProfile chargingProfile;
+
+ /**
+ * Constructor for the SetChargingProfileRequest class
+ *
+ * @param evseId For TxDefaultProfile an evseId=0 applies the profile to each individual evse. For
+ * ChargingStationMaxProfile and ChargingStationExternalConstraints an evseId=0 contains an
+ * overal limit for the whole Charging Station.
+ * @param chargingProfile A ChargingProfile consists of ChargingSchedule, describing the amount of
+ * power or current that can be delivered per time interval.
+ */
+ public SetChargingProfileRequest(Integer evseId, ChargingProfile chargingProfile) {
+ setEvseId(evseId);
+ setChargingProfile(chargingProfile);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetChargingProfileRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets for TxDefaultProfile an evseId=0 applies the profile to each individual evse. For
+ * ChargingStationMaxProfile and ChargingStationExternalConstraints an evseId=0 contains an overal
+ * limit for the whole Charging Station.
+ *
+ * @return For TxDefaultProfile an evseId=0 applies the profile to each individual evse
+ */
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets for TxDefaultProfile an evseId=0 applies the profile to each individual evse. For
+ * ChargingStationMaxProfile and ChargingStationExternalConstraints an evseId=0 contains an overal
+ * limit for the whole Charging Station.
+ *
+ * @param evseId For TxDefaultProfile an evseId=0 applies the profile to each individual evse
+ */
+ public void setEvseId(Integer evseId) {
+ if (!isValidEvseId(evseId)) {
+ throw new PropertyConstraintException(evseId, "evseId is invalid");
+ }
+ this.evseId = evseId;
+ }
+
+ /**
+ * Returns whether the given evseId is valid
+ *
+ * @param evseId the evseId to check the validity of
+ * @return {@code true} if evseId is valid, {@code false} if not
+ */
+ private boolean isValidEvseId(Integer evseId) {
+ return evseId != null;
+ }
+
+ /**
+ * Gets a ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ *
+ * @return A ChargingProfile consists of ChargingSchedule, describing the amount of power or
+ * current that can be delivered per time interval
+ */
+ public ChargingProfile getChargingProfile() {
+ return chargingProfile;
+ }
+
+ /**
+ * Sets a ChargingProfile consists of ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ *
+ * @param chargingProfile A ChargingProfile consists of ChargingSchedule, describing the amount of
+ * power or current that can be delivered per time interval
+ */
+ public void setChargingProfile(ChargingProfile chargingProfile) {
+ if (!isValidChargingProfile(chargingProfile)) {
+ throw new PropertyConstraintException(chargingProfile, "chargingProfile is invalid");
+ }
+ this.chargingProfile = chargingProfile;
+ }
+
+ /**
+ * Returns whether the given chargingProfile is valid
+ *
+ * @param chargingProfile the chargingProfile to check the validity of
+ * @return {@code true} if chargingProfile is valid, {@code false} if not
+ */
+ private boolean isValidChargingProfile(ChargingProfile chargingProfile) {
+ return chargingProfile != null && chargingProfile.validate();
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidEvseId(evseId)
+ && isValidChargingProfile(chargingProfile);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetChargingProfileRequest that = (SetChargingProfileRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(evseId, that.evseId)
+ && Objects.equals(chargingProfile, that.chargingProfile);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, evseId, chargingProfile);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("evseId", evseId)
+ .add("chargingProfile", chargingProfile)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetChargingProfileResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetChargingProfileResponse.java
new file mode 100644
index 000000000..a8b29950a
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetChargingProfileResponse.java
@@ -0,0 +1,221 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ChargingProfileStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetChargingProfileResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetChargingProfileResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Returns whether the Charging Station has been able to process the message successfully. This
+ * does not guarantee the schedule will be followed to the letter. There might be other
+ * constraints the Charging Station may need to take into account.
+ */
+ private ChargingProfileStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the SetChargingProfileResponse class
+ *
+ * @param status Returns whether the Charging Station has been able to process the message
+ * successfully. This does not guarantee the schedule will be followed to the letter. There
+ * might be other constraints the Charging Station may need to take into account.
+ */
+ public SetChargingProfileResponse(ChargingProfileStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetChargingProfileResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets returns whether the Charging Station has been able to process the message successfully.
+ * This does not guarantee the schedule will be followed to the letter. There might be other
+ * constraints the Charging Station may need to take into account.
+ *
+ * @return Returns whether the Charging Station has been able to process the message successfully
+ */
+ public ChargingProfileStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets returns whether the Charging Station has been able to process the message successfully.
+ * This does not guarantee the schedule will be followed to the letter. There might be other
+ * constraints the Charging Station may need to take into account.
+ *
+ * @param status Returns whether the Charging Station has been able to process the message
+ * successfully
+ */
+ public void setStatus(ChargingProfileStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(ChargingProfileStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public SetChargingProfileResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetChargingProfileResponse that = (SetChargingProfileResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetDisplayMessageRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetDisplayMessageRequest.java
new file mode 100644
index 000000000..5af7b5dbc
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetDisplayMessageRequest.java
@@ -0,0 +1,169 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.MessageInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetDisplayMessageRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetDisplayMessageRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Message Info
+ *
+ * Message details, for a message to be displayed on a Charging Station.
+ */
+ private MessageInfo message;
+
+ /**
+ * Constructor for the SetDisplayMessageRequest class
+ *
+ * @param message Message details, for a message to be displayed on a Charging Station.
+ */
+ public SetDisplayMessageRequest(MessageInfo message) {
+ setMessage(message);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetDisplayMessageRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets message details, for a message to be displayed on a Charging Station.
+ *
+ * @return Message details, for a message to be displayed on a Charging Station
+ */
+ public MessageInfo getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets message details, for a message to be displayed on a Charging Station.
+ *
+ * @param message Message details, for a message to be displayed on a Charging Station
+ */
+ public void setMessage(MessageInfo message) {
+ if (!isValidMessage(message)) {
+ throw new PropertyConstraintException(message, "message is invalid");
+ }
+ this.message = message;
+ }
+
+ /**
+ * Returns whether the given message is valid
+ *
+ * @param message the message to check the validity of
+ * @return {@code true} if message is valid, {@code false} if not
+ */
+ private boolean isValidMessage(MessageInfo message) {
+ return message != null && message.validate();
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidMessage(message);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetDisplayMessageRequest that = (SetDisplayMessageRequest) o;
+ return Objects.equals(customData, that.customData) && Objects.equals(message, that.message);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, message);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("message", message)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetDisplayMessageResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetDisplayMessageResponse.java
new file mode 100644
index 000000000..e9ad9a128
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetDisplayMessageResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.DisplayMessageStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetDisplayMessageResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetDisplayMessageResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the Charging Station is able to display the message. */
+ private DisplayMessageStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the SetDisplayMessageResponse class
+ *
+ * @param status Whether the Charging Station is able to display the message.
+ */
+ public SetDisplayMessageResponse(DisplayMessageStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetDisplayMessageResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Charging Station is able to display the message.
+ *
+ * @return Whether the Charging Station is able to display the message
+ */
+ public DisplayMessageStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station is able to display the message.
+ *
+ * @param status Whether the Charging Station is able to display the message
+ */
+ public void setStatus(DisplayMessageStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(DisplayMessageStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public SetDisplayMessageResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetDisplayMessageResponse that = (SetDisplayMessageResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetMonitoringBaseRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetMonitoringBaseRequest.java
new file mode 100644
index 000000000..084251e14
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetMonitoringBaseRequest.java
@@ -0,0 +1,166 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.MonitoringBaseEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetMonitoringBaseRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetMonitoringBaseRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Specify which monitoring base will be set */
+ private MonitoringBaseEnum monitoringBase;
+
+ /**
+ * Constructor for the SetMonitoringBaseRequest class
+ *
+ * @param monitoringBase Specify which monitoring base will be set
+ */
+ public SetMonitoringBaseRequest(MonitoringBaseEnum monitoringBase) {
+ setMonitoringBase(monitoringBase);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetMonitoringBaseRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets specify which monitoring base will be set
+ *
+ * @return Specify which monitoring base will be set
+ */
+ public MonitoringBaseEnum getMonitoringBase() {
+ return monitoringBase;
+ }
+
+ /**
+ * Sets specify which monitoring base will be set
+ *
+ * @param monitoringBase Specify which monitoring base will be set
+ */
+ public void setMonitoringBase(MonitoringBaseEnum monitoringBase) {
+ if (!isValidMonitoringBase(monitoringBase)) {
+ throw new PropertyConstraintException(monitoringBase, "monitoringBase is invalid");
+ }
+ this.monitoringBase = monitoringBase;
+ }
+
+ /**
+ * Returns whether the given monitoringBase is valid
+ *
+ * @param monitoringBase the monitoringBase to check the validity of
+ * @return {@code true} if monitoringBase is valid, {@code false} if not
+ */
+ private boolean isValidMonitoringBase(MonitoringBaseEnum monitoringBase) {
+ return monitoringBase != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidMonitoringBase(monitoringBase);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetMonitoringBaseRequest that = (SetMonitoringBaseRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(monitoringBase, that.monitoringBase);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, monitoringBase);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("monitoringBase", monitoringBase)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetMonitoringBaseResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetMonitoringBaseResponse.java
new file mode 100644
index 000000000..ed786c309
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetMonitoringBaseResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GenericDeviceModelStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetMonitoringBaseResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetMonitoringBaseResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the Charging Station was able to accept the request. */
+ private GenericDeviceModelStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the SetMonitoringBaseResponse class
+ *
+ * @param status Whether the Charging Station was able to accept the request.
+ */
+ public SetMonitoringBaseResponse(GenericDeviceModelStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetMonitoringBaseResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Charging Station was able to accept the request.
+ *
+ * @return Whether the Charging Station was able to accept the request
+ */
+ public GenericDeviceModelStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station was able to accept the request.
+ *
+ * @param status Whether the Charging Station was able to accept the request
+ */
+ public void setStatus(GenericDeviceModelStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GenericDeviceModelStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public SetMonitoringBaseResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetMonitoringBaseResponse that = (SetMonitoringBaseResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetMonitoringLevelRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetMonitoringLevelRequest.java
new file mode 100644
index 000000000..4837a54f9
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetMonitoringLevelRequest.java
@@ -0,0 +1,200 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetMonitoringLevelRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetMonitoringLevelRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * The Charging Station SHALL only report events with a severity number lower than or equal to
+ * this severity. The severity range is 0-9, with 0 as the highest and 9 as the lowest severity
+ * level.
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetMonitoringLevelResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the Charging Station was able to accept the request. */
+ private GenericStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the SetMonitoringLevelResponse class
+ *
+ * @param status Whether the Charging Station was able to accept the request.
+ */
+ public SetMonitoringLevelResponse(GenericStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetMonitoringLevelResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Charging Station was able to accept the request.
+ *
+ * @return Whether the Charging Station was able to accept the request
+ */
+ public GenericStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station was able to accept the request.
+ *
+ * @param status Whether the Charging Station was able to accept the request
+ */
+ public void setStatus(GenericStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GenericStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public SetMonitoringLevelResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetMonitoringLevelResponse that = (SetMonitoringLevelResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetNetworkProfileRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetNetworkProfileRequest.java
new file mode 100644
index 000000000..aac374d9e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetNetworkProfileRequest.java
@@ -0,0 +1,217 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.NetworkConnectionProfile;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetNetworkProfileRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetNetworkProfileRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Slot in which the configuration should be stored. */
+ private Integer configurationSlot;
+
+ /**
+ * Communication Function
+ *
+ * The NetworkConnectionProfile defines the functional and technical parameters of a
+ * communication link.
+ */
+ private NetworkConnectionProfile connectionData;
+
+ /**
+ * Constructor for the SetNetworkProfileRequest class
+ *
+ * @param configurationSlot Slot in which the configuration should be stored.
+ * @param connectionData The NetworkConnectionProfile defines the functional and technical
+ * parameters of a communication link.
+ */
+ public SetNetworkProfileRequest(
+ Integer configurationSlot, NetworkConnectionProfile connectionData) {
+ setConfigurationSlot(configurationSlot);
+ setConnectionData(connectionData);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetNetworkProfileRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets slot in which the configuration should be stored.
+ *
+ * @return Slot in which the configuration should be stored
+ */
+ public Integer getConfigurationSlot() {
+ return configurationSlot;
+ }
+
+ /**
+ * Sets slot in which the configuration should be stored.
+ *
+ * @param configurationSlot Slot in which the configuration should be stored
+ */
+ public void setConfigurationSlot(Integer configurationSlot) {
+ if (!isValidConfigurationSlot(configurationSlot)) {
+ throw new PropertyConstraintException(configurationSlot, "configurationSlot is invalid");
+ }
+ this.configurationSlot = configurationSlot;
+ }
+
+ /**
+ * Returns whether the given configurationSlot is valid
+ *
+ * @param configurationSlot the configurationSlot to check the validity of
+ * @return {@code true} if configurationSlot is valid, {@code false} if not
+ */
+ private boolean isValidConfigurationSlot(Integer configurationSlot) {
+ return configurationSlot != null;
+ }
+
+ /**
+ * Gets the NetworkConnectionProfile defines the functional and technical parameters of a
+ * communication link.
+ *
+ * @return The NetworkConnectionProfile defines the functional and technical parameters of a
+ * communication link
+ */
+ public NetworkConnectionProfile getConnectionData() {
+ return connectionData;
+ }
+
+ /**
+ * Sets the NetworkConnectionProfile defines the functional and technical parameters of a
+ * communication link.
+ *
+ * @param connectionData The NetworkConnectionProfile defines the functional and technical
+ * parameters of a communication link
+ */
+ public void setConnectionData(NetworkConnectionProfile connectionData) {
+ if (!isValidConnectionData(connectionData)) {
+ throw new PropertyConstraintException(connectionData, "connectionData is invalid");
+ }
+ this.connectionData = connectionData;
+ }
+
+ /**
+ * Returns whether the given connectionData is valid
+ *
+ * @param connectionData the connectionData to check the validity of
+ * @return {@code true} if connectionData is valid, {@code false} if not
+ */
+ private boolean isValidConnectionData(NetworkConnectionProfile connectionData) {
+ return connectionData != null && connectionData.validate();
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidConfigurationSlot(configurationSlot)
+ && isValidConnectionData(connectionData);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetNetworkProfileRequest that = (SetNetworkProfileRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(configurationSlot, that.configurationSlot)
+ && Objects.equals(connectionData, that.connectionData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, configurationSlot, connectionData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("configurationSlot", configurationSlot)
+ .add("connectionData", connectionData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetNetworkProfileResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetNetworkProfileResponse.java
new file mode 100644
index 000000000..a9a45fcb6
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetNetworkProfileResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.SetNetworkProfileStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetNetworkProfileResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetNetworkProfileResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Result of operation. */
+ private SetNetworkProfileStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the SetNetworkProfileResponse class
+ *
+ * @param status Result of operation.
+ */
+ public SetNetworkProfileResponse(SetNetworkProfileStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetNetworkProfileResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets result of operation.
+ *
+ * @return Result of operation
+ */
+ public SetNetworkProfileStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets result of operation.
+ *
+ * @param status Result of operation
+ */
+ public void setStatus(SetNetworkProfileStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(SetNetworkProfileStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public SetNetworkProfileResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetNetworkProfileResponse that = (SetNetworkProfileResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetVariableMonitoringRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetVariableMonitoringRequest.java
new file mode 100644
index 000000000..bed127e03
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetVariableMonitoringRequest.java
@@ -0,0 +1,169 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.SetMonitoringData;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetVariableMonitoringRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetVariableMonitoringRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Class to hold parameters of SetVariableMonitoring request. */
+ private SetMonitoringData[] setMonitoringData;
+
+ /**
+ * Constructor for the SetVariableMonitoringRequest class
+ *
+ * @param setMonitoringData Class to hold parameters of SetVariableMonitoring request.
+ */
+ public SetVariableMonitoringRequest(SetMonitoringData[] setMonitoringData) {
+ setSetMonitoringData(setMonitoringData);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetVariableMonitoringRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets class to hold parameters of SetVariableMonitoring request.
+ *
+ * @return Class to hold parameters of SetVariableMonitoring request
+ */
+ public SetMonitoringData[] getSetMonitoringData() {
+ return setMonitoringData;
+ }
+
+ /**
+ * Sets class to hold parameters of SetVariableMonitoring request.
+ *
+ * @param setMonitoringData Class to hold parameters of SetVariableMonitoring request
+ */
+ public void setSetMonitoringData(SetMonitoringData[] setMonitoringData) {
+ if (!isValidSetMonitoringData(setMonitoringData)) {
+ throw new PropertyConstraintException(setMonitoringData, "setMonitoringData is invalid");
+ }
+ this.setMonitoringData = setMonitoringData;
+ }
+
+ /**
+ * Returns whether the given setMonitoringData is valid
+ *
+ * @param setMonitoringData the setMonitoringData to check the validity of
+ * @return {@code true} if setMonitoringData is valid, {@code false} if not
+ */
+ private boolean isValidSetMonitoringData(SetMonitoringData[] setMonitoringData) {
+ return setMonitoringData != null
+ && setMonitoringData.length >= 1
+ && Arrays.stream(setMonitoringData).allMatch(item -> item.validate());
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidSetMonitoringData(setMonitoringData);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetVariableMonitoringRequest that = (SetVariableMonitoringRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(setMonitoringData, that.setMonitoringData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(setMonitoringData));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("setMonitoringData", setMonitoringData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetVariableMonitoringResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetVariableMonitoringResponse.java
new file mode 100644
index 000000000..4cd581387
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetVariableMonitoringResponse.java
@@ -0,0 +1,164 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.SetMonitoringResult;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetVariableMonitoringResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetVariableMonitoringResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Class to hold result of SetVariableMonitoring request. */
+ private SetMonitoringResult[] setMonitoringResult;
+
+ /**
+ * Constructor for the SetVariableMonitoringResponse class
+ *
+ * @param setMonitoringResult Class to hold result of SetVariableMonitoring request.
+ */
+ public SetVariableMonitoringResponse(SetMonitoringResult[] setMonitoringResult) {
+ setSetMonitoringResult(setMonitoringResult);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetVariableMonitoringResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets class to hold result of SetVariableMonitoring request.
+ *
+ * @return Class to hold result of SetVariableMonitoring request
+ */
+ public SetMonitoringResult[] getSetMonitoringResult() {
+ return setMonitoringResult;
+ }
+
+ /**
+ * Sets class to hold result of SetVariableMonitoring request.
+ *
+ * @param setMonitoringResult Class to hold result of SetVariableMonitoring request
+ */
+ public void setSetMonitoringResult(SetMonitoringResult[] setMonitoringResult) {
+ if (!isValidSetMonitoringResult(setMonitoringResult)) {
+ throw new PropertyConstraintException(setMonitoringResult, "setMonitoringResult is invalid");
+ }
+ this.setMonitoringResult = setMonitoringResult;
+ }
+
+ /**
+ * Returns whether the given setMonitoringResult is valid
+ *
+ * @param setMonitoringResult the setMonitoringResult to check the validity of
+ * @return {@code true} if setMonitoringResult is valid, {@code false} if not
+ */
+ private boolean isValidSetMonitoringResult(SetMonitoringResult[] setMonitoringResult) {
+ return setMonitoringResult != null
+ && setMonitoringResult.length >= 1
+ && Arrays.stream(setMonitoringResult).allMatch(item -> item.validate());
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidSetMonitoringResult(setMonitoringResult);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetVariableMonitoringResponse that = (SetVariableMonitoringResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(setMonitoringResult, that.setMonitoringResult);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(setMonitoringResult));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("setMonitoringResult", setMonitoringResult)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetVariablesRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetVariablesRequest.java
new file mode 100644
index 000000000..89785fdc5
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetVariablesRequest.java
@@ -0,0 +1,169 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.SetVariableData;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetVariablesRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetVariablesRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** setVariableData */
+ private SetVariableData[] setVariableData;
+
+ /**
+ * Constructor for the SetVariablesRequest class
+ *
+ * @param setVariableData setVariableData
+ */
+ public SetVariablesRequest(SetVariableData[] setVariableData) {
+ setSetVariableData(setVariableData);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetVariablesRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets setVariableData
+ *
+ * @return setVariableData
+ */
+ public SetVariableData[] getSetVariableData() {
+ return setVariableData;
+ }
+
+ /**
+ * Sets setVariableData
+ *
+ * @param setVariableData setVariableData
+ */
+ public void setSetVariableData(SetVariableData[] setVariableData) {
+ if (!isValidSetVariableData(setVariableData)) {
+ throw new PropertyConstraintException(setVariableData, "setVariableData is invalid");
+ }
+ this.setVariableData = setVariableData;
+ }
+
+ /**
+ * Returns whether the given setVariableData is valid
+ *
+ * @param setVariableData the setVariableData to check the validity of
+ * @return {@code true} if setVariableData is valid, {@code false} if not
+ */
+ private boolean isValidSetVariableData(SetVariableData[] setVariableData) {
+ return setVariableData != null
+ && setVariableData.length >= 1
+ && Arrays.stream(setVariableData).allMatch(item -> item.validate());
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidSetVariableData(setVariableData);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetVariablesRequest that = (SetVariablesRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(setVariableData, that.setVariableData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(setVariableData));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("setVariableData", setVariableData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetVariablesResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetVariablesResponse.java
new file mode 100644
index 000000000..b2b37ea16
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetVariablesResponse.java
@@ -0,0 +1,164 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.SetVariableResult;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetVariablesResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SetVariablesResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** setVariableResult */
+ private SetVariableResult[] setVariableResult;
+
+ /**
+ * Constructor for the SetVariablesResponse class
+ *
+ * @param setVariableResult setVariableResult
+ */
+ public SetVariablesResponse(SetVariableResult[] setVariableResult) {
+ setSetVariableResult(setVariableResult);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetVariablesResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets setVariableResult
+ *
+ * @return setVariableResult
+ */
+ public SetVariableResult[] getSetVariableResult() {
+ return setVariableResult;
+ }
+
+ /**
+ * Sets setVariableResult
+ *
+ * @param setVariableResult setVariableResult
+ */
+ public void setSetVariableResult(SetVariableResult[] setVariableResult) {
+ if (!isValidSetVariableResult(setVariableResult)) {
+ throw new PropertyConstraintException(setVariableResult, "setVariableResult is invalid");
+ }
+ this.setVariableResult = setVariableResult;
+ }
+
+ /**
+ * Returns whether the given setVariableResult is valid
+ *
+ * @param setVariableResult the setVariableResult to check the validity of
+ * @return {@code true} if setVariableResult is valid, {@code false} if not
+ */
+ private boolean isValidSetVariableResult(SetVariableResult[] setVariableResult) {
+ return setVariableResult != null
+ && setVariableResult.length >= 1
+ && Arrays.stream(setVariableResult).allMatch(item -> item.validate());
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidSetVariableResult(setVariableResult);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetVariablesResponse that = (SetVariablesResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(setVariableResult, that.setVariableResult);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(setVariableResult));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("setVariableResult", setVariableResult)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SignCertificateRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SignCertificateRequest.java
new file mode 100644
index 000000000..e4233907e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SignCertificateRequest.java
@@ -0,0 +1,221 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CertificateSigningUseEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SignCertificateRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SignCertificateRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * The Charging Station SHALL send the public key in form of a Certificate Signing Request (CSR)
+ * as described in RFC 2986 [22] and then PEM encoded, using the SignCertificateRequest message.
+ */
+ private String csr;
+
+ /**
+ * The type of certificate that is to be signed. When omitted the certificate is to be used for
+ * both the 15118 connection (if implemented) and the Charging Station to CSMS connection.
+ */
+ @Nullable private CertificateSigningUseEnum certificateType;
+
+ /**
+ * Constructor for the SignCertificateRequest class
+ *
+ * @param csr The Charging Station SHALL send the public key in form of a Certificate Signing
+ * Request (CSR) as described in RFC 2986 [22] and then PEM encoded, using the
+ * SignCertificateRequest message.
+ */
+ public SignCertificateRequest(String csr) {
+ setCsr(csr);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SignCertificateRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the Charging Station SHALL send the public key in form of a Certificate Signing Request
+ * (CSR) as described in RFC 2986 [22] and then PEM encoded, using the SignCertificateRequest
+ * message.
+ *
+ * @return The Charging Station SHALL send the public key in form of a Certificate Signing Request
+ * (CSR) as described in RFC 2986 [22] and then PEM encoded, using the SignCertificateRequest
+ * message
+ */
+ public String getCsr() {
+ return csr;
+ }
+
+ /**
+ * Sets the Charging Station SHALL send the public key in form of a Certificate Signing Request
+ * (CSR) as described in RFC 2986 [22] and then PEM encoded, using the SignCertificateRequest
+ * message.
+ *
+ * @param csr The Charging Station SHALL send the public key in form of a Certificate Signing
+ * Request (CSR) as described in RFC 2986 [22] and then PEM encoded, using the
+ * SignCertificateRequest message
+ */
+ public void setCsr(String csr) {
+ if (!isValidCsr(csr)) {
+ throw new PropertyConstraintException(csr, "csr is invalid");
+ }
+ this.csr = csr;
+ }
+
+ /**
+ * Returns whether the given csr is valid
+ *
+ * @param csr the csr to check the validity of
+ * @return {@code true} if csr is valid, {@code false} if not
+ */
+ private boolean isValidCsr(String csr) {
+ return csr != null && csr.length() <= 5500;
+ }
+
+ /**
+ * Gets the type of certificate that is to be signed. When omitted the certificate is to be used
+ * for both the 15118 connection (if implemented) and the Charging Station to CSMS connection.
+ *
+ * @return The type of certificate that is to be signed
+ */
+ @Nullable
+ public CertificateSigningUseEnum getCertificateType() {
+ return certificateType;
+ }
+
+ /**
+ * Sets the type of certificate that is to be signed. When omitted the certificate is to be used
+ * for both the 15118 connection (if implemented) and the Charging Station to CSMS connection.
+ *
+ * @param certificateType The type of certificate that is to be signed
+ */
+ public void setCertificateType(@Nullable CertificateSigningUseEnum certificateType) {
+ this.certificateType = certificateType;
+ }
+
+ /**
+ * Adds the type of certificate that is to be signed. When omitted the certificate is to be used
+ * for both the 15118 connection (if implemented) and the Charging Station to CSMS connection.
+ *
+ * @param certificateType The type of certificate that is to be signed
+ * @return this
+ */
+ public SignCertificateRequest withCertificateType(
+ @Nullable CertificateSigningUseEnum certificateType) {
+ setCertificateType(certificateType);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidCsr(csr);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SignCertificateRequest that = (SignCertificateRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(csr, that.csr)
+ && Objects.equals(certificateType, that.certificateType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, csr, certificateType);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("csr", csr)
+ .add("certificateType", certificateType)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SignCertificateResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SignCertificateResponse.java
new file mode 100644
index 000000000..cea21f39e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SignCertificateResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GenericStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SignCertificateResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class SignCertificateResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Specifies whether the CSMS can process the request. */
+ private GenericStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the SignCertificateResponse class
+ *
+ * @param status Specifies whether the CSMS can process the request.
+ */
+ public SignCertificateResponse(GenericStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SignCertificateResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets specifies whether the CSMS can process the request.
+ *
+ * @return Specifies whether the CSMS can process the request
+ */
+ public GenericStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets specifies whether the CSMS can process the request.
+ *
+ * @param status Specifies whether the CSMS can process the request
+ */
+ public void setStatus(GenericStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(GenericStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public SignCertificateResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SignCertificateResponse that = (SignCertificateResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/StatusNotificationRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/StatusNotificationRequest.java
new file mode 100644
index 000000000..2f2499028
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/StatusNotificationRequest.java
@@ -0,0 +1,297 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.ConnectorStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * StatusNotificationRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class StatusNotificationRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * The time for which the status is reported. If absent time of receipt of the message will be
+ * assumed.
+ */
+ private ZonedDateTime timestamp;
+
+ /** The current status of the Connector. */
+ private ConnectorStatusEnum connectorStatus;
+
+ /** The id of the EVSE to which the connector belongs for which the the status is reported. */
+ private Integer evseId;
+
+ /** The id of the connector within the EVSE for which the status is reported. */
+ private Integer connectorId;
+
+ /**
+ * Constructor for the StatusNotificationRequest class
+ *
+ * @param timestamp The time for which the status is reported. If absent time of receipt of the
+ * message will be assumed.
+ * @param connectorStatus The current status of the Connector.
+ * @param evseId The id of the EVSE to which the connector belongs for which the the status is
+ * reported.
+ * @param connectorId The id of the connector within the EVSE for which the status is reported.
+ */
+ public StatusNotificationRequest(
+ ZonedDateTime timestamp,
+ ConnectorStatusEnum connectorStatus,
+ Integer evseId,
+ Integer connectorId) {
+ setTimestamp(timestamp);
+ setConnectorStatus(connectorStatus);
+ setEvseId(evseId);
+ setConnectorId(connectorId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public StatusNotificationRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the time for which the status is reported. If absent time of receipt of the message will
+ * be assumed.
+ *
+ * @return The time for which the status is reported
+ */
+ public ZonedDateTime getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * Sets the time for which the status is reported. If absent time of receipt of the message will
+ * be assumed.
+ *
+ * @param timestamp The time for which the status is reported
+ */
+ public void setTimestamp(ZonedDateTime timestamp) {
+ if (!isValidTimestamp(timestamp)) {
+ throw new PropertyConstraintException(timestamp, "timestamp is invalid");
+ }
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * Returns whether the given timestamp is valid
+ *
+ * @param timestamp the timestamp to check the validity of
+ * @return {@code true} if timestamp is valid, {@code false} if not
+ */
+ private boolean isValidTimestamp(ZonedDateTime timestamp) {
+ return timestamp != null;
+ }
+
+ /**
+ * Gets the current status of the Connector.
+ *
+ * @return The current status of the Connector
+ */
+ public ConnectorStatusEnum getConnectorStatus() {
+ return connectorStatus;
+ }
+
+ /**
+ * Sets the current status of the Connector.
+ *
+ * @param connectorStatus The current status of the Connector
+ */
+ public void setConnectorStatus(ConnectorStatusEnum connectorStatus) {
+ if (!isValidConnectorStatus(connectorStatus)) {
+ throw new PropertyConstraintException(connectorStatus, "connectorStatus is invalid");
+ }
+ this.connectorStatus = connectorStatus;
+ }
+
+ /**
+ * Returns whether the given connectorStatus is valid
+ *
+ * @param connectorStatus the connectorStatus to check the validity of
+ * @return {@code true} if connectorStatus is valid, {@code false} if not
+ */
+ private boolean isValidConnectorStatus(ConnectorStatusEnum connectorStatus) {
+ return connectorStatus != null;
+ }
+
+ /**
+ * Gets the id of the EVSE to which the connector belongs for which the the status is reported.
+ *
+ * @return The id of the EVSE to which the connector belongs for which the the status is reported
+ */
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets the id of the EVSE to which the connector belongs for which the the status is reported.
+ *
+ * @param evseId The id of the EVSE to which the connector belongs for which the the status is
+ * reported
+ */
+ public void setEvseId(Integer evseId) {
+ if (!isValidEvseId(evseId)) {
+ throw new PropertyConstraintException(evseId, "evseId is invalid");
+ }
+ this.evseId = evseId;
+ }
+
+ /**
+ * Returns whether the given evseId is valid
+ *
+ * @param evseId the evseId to check the validity of
+ * @return {@code true} if evseId is valid, {@code false} if not
+ */
+ private boolean isValidEvseId(Integer evseId) {
+ return evseId != null;
+ }
+
+ /**
+ * Gets the id of the connector within the EVSE for which the status is reported.
+ *
+ * @return The id of the connector within the EVSE for which the status is reported
+ */
+ public Integer getConnectorId() {
+ return connectorId;
+ }
+
+ /**
+ * Sets the id of the connector within the EVSE for which the status is reported.
+ *
+ * @param connectorId The id of the connector within the EVSE for which the status is reported
+ */
+ public void setConnectorId(Integer connectorId) {
+ if (!isValidConnectorId(connectorId)) {
+ throw new PropertyConstraintException(connectorId, "connectorId is invalid");
+ }
+ this.connectorId = connectorId;
+ }
+
+ /**
+ * Returns whether the given connectorId is valid
+ *
+ * @param connectorId the connectorId to check the validity of
+ * @return {@code true} if connectorId is valid, {@code false} if not
+ */
+ private boolean isValidConnectorId(Integer connectorId) {
+ return connectorId != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidTimestamp(timestamp)
+ && isValidConnectorStatus(connectorStatus)
+ && isValidEvseId(evseId)
+ && isValidConnectorId(connectorId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ StatusNotificationRequest that = (StatusNotificationRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(timestamp, that.timestamp)
+ && Objects.equals(connectorStatus, that.connectorStatus)
+ && Objects.equals(evseId, that.evseId)
+ && Objects.equals(connectorId, that.connectorId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, timestamp, connectorStatus, evseId, connectorId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("timestamp", timestamp)
+ .add("connectorStatus", connectorStatus)
+ .add("evseId", evseId)
+ .add("connectorId", connectorId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/StatusNotificationResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/StatusNotificationResponse.java
new file mode 100644
index 000000000..13cba4921
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/StatusNotificationResponse.java
@@ -0,0 +1,118 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * StatusNotificationResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class StatusNotificationResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Constructor for the StatusNotificationResponse class */
+ public StatusNotificationResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public StatusNotificationResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ StatusNotificationResponse that = (StatusNotificationResponse) o;
+ return Objects.equals(customData, that.customData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/TransactionEventRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/TransactionEventRequest.java
new file mode 100644
index 000000000..e09d0e4da
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/TransactionEventRequest.java
@@ -0,0 +1,696 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.EVSE;
+import eu.chargetime.ocpp.v201.model.types.IdToken;
+import eu.chargetime.ocpp.v201.model.types.MeterValue;
+import eu.chargetime.ocpp.v201.model.types.Transaction;
+import eu.chargetime.ocpp.v201.model.types.TransactionEventEnum;
+import eu.chargetime.ocpp.v201.model.types.TriggerReasonEnum;
+import java.time.ZonedDateTime;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * TransactionEventRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class TransactionEventRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * The type of this event. The first TransactionEvent of a transaction SHALL contain: "Started"
+ * The last TransactionEvent of a transaction SHALL contain: "Ended" All others SHALL contain:
+ * "Updated"
+ */
+ private TransactionEventEnum eventType;
+
+ /**
+ * Meter Value
+ *
+ * Collection of one or more sampled values in MeterValuesRequest and TransactionEvent. All
+ * sampled values in a MeterValue are sampled at the same point in time.
+ */
+ @Nullable private MeterValue[] meterValue;
+
+ /** The date and time at which this transaction event occurred. */
+ private ZonedDateTime timestamp;
+
+ /** Reason the Charging Station sends this message to the CSMS */
+ private TriggerReasonEnum triggerReason;
+
+ /**
+ * Incremental sequence number, helps with determining if all messages of a transaction have been
+ * received.
+ */
+ private Integer seqNo;
+
+ /**
+ * Indication that this transaction event happened when the Charging Station was offline. Default
+ * = false, meaning: the event occurred when the Charging Station was online.
+ */
+ @Nullable private Boolean offline;
+
+ /**
+ * If the Charging Station is able to report the number of phases used, then it SHALL provide it.
+ * When omitted the CSMS may be able to determine the number of phases used via device management.
+ */
+ @Nullable private Integer numberOfPhasesUsed;
+
+ /** The maximum current of the connected cable in Ampere (A). */
+ @Nullable private Integer cableMaxCurrent;
+
+ /** The Id of the reservation that terminates as a result of this transaction. */
+ @Nullable private Integer reservationId;
+
+ /** Transaction */
+ private Transaction transactionInfo;
+
+ /**
+ * EVSE
+ *
+ * Electric Vehicle Supply Equipment
+ */
+ @Nullable private EVSE evse;
+
+ /**
+ * A case insensitive identifier to use for the authorization and the type of authorization to
+ * support multiple forms of identifiers.
+ */
+ @Nullable private IdToken idToken;
+
+ /**
+ * Constructor for the TransactionEventRequest class
+ *
+ * @param eventType The type of this event. The first TransactionEvent of a transaction SHALL
+ * contain: "Started" The last TransactionEvent of a transaction SHALL contain: "Ended" All
+ * others SHALL contain: "Updated"
+ * @param timestamp The date and time at which this transaction event occurred.
+ * @param triggerReason Reason the Charging Station sends this message to the CSMS
+ * @param seqNo Incremental sequence number, helps with determining if all messages of a
+ * transaction have been received.
+ * @param transactionInfo Transaction
+ */
+ public TransactionEventRequest(
+ TransactionEventEnum eventType,
+ ZonedDateTime timestamp,
+ TriggerReasonEnum triggerReason,
+ Integer seqNo,
+ Transaction transactionInfo) {
+ setEventType(eventType);
+ setTimestamp(timestamp);
+ setTriggerReason(triggerReason);
+ setSeqNo(seqNo);
+ setTransactionInfo(transactionInfo);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public TransactionEventRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the type of this event. The first TransactionEvent of a transaction SHALL contain:
+ * "Started" The last TransactionEvent of a transaction SHALL contain: "Ended" All others SHALL
+ * contain: "Updated"
+ *
+ * @return The type of this event
+ */
+ public TransactionEventEnum getEventType() {
+ return eventType;
+ }
+
+ /**
+ * Sets the type of this event. The first TransactionEvent of a transaction SHALL contain:
+ * "Started" The last TransactionEvent of a transaction SHALL contain: "Ended" All others SHALL
+ * contain: "Updated"
+ *
+ * @param eventType The type of this event
+ */
+ public void setEventType(TransactionEventEnum eventType) {
+ if (!isValidEventType(eventType)) {
+ throw new PropertyConstraintException(eventType, "eventType is invalid");
+ }
+ this.eventType = eventType;
+ }
+
+ /**
+ * Returns whether the given eventType is valid
+ *
+ * @param eventType the eventType to check the validity of
+ * @return {@code true} if eventType is valid, {@code false} if not
+ */
+ private boolean isValidEventType(TransactionEventEnum eventType) {
+ return eventType != null;
+ }
+
+ /**
+ * Gets collection of one or more sampled values in MeterValuesRequest and TransactionEvent. All
+ * sampled values in a MeterValue are sampled at the same point in time.
+ *
+ * @return Collection of one or more sampled values in MeterValuesRequest and TransactionEvent
+ */
+ @Nullable
+ public MeterValue[] getMeterValue() {
+ return meterValue;
+ }
+
+ /**
+ * Sets collection of one or more sampled values in MeterValuesRequest and TransactionEvent. All
+ * sampled values in a MeterValue are sampled at the same point in time.
+ *
+ * @param meterValue Collection of one or more sampled values in MeterValuesRequest and
+ * TransactionEvent
+ */
+ public void setMeterValue(@Nullable MeterValue[] meterValue) {
+ if (!isValidMeterValue(meterValue)) {
+ throw new PropertyConstraintException(meterValue, "meterValue is invalid");
+ }
+ this.meterValue = meterValue;
+ }
+
+ /**
+ * Returns whether the given meterValue is valid
+ *
+ * @param meterValue the meterValue to check the validity of
+ * @return {@code true} if meterValue is valid, {@code false} if not
+ */
+ private boolean isValidMeterValue(@Nullable MeterValue[] meterValue) {
+ return meterValue == null
+ || (meterValue.length >= 1 && Arrays.stream(meterValue).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds collection of one or more sampled values in MeterValuesRequest and TransactionEvent. All
+ * sampled values in a MeterValue are sampled at the same point in time.
+ *
+ * @param meterValue Collection of one or more sampled values in MeterValuesRequest and
+ * TransactionEvent
+ * @return this
+ */
+ public TransactionEventRequest withMeterValue(@Nullable MeterValue[] meterValue) {
+ setMeterValue(meterValue);
+ return this;
+ }
+
+ /**
+ * Gets the date and time at which this transaction event occurred.
+ *
+ * @return The date and time at which this transaction event occurred
+ */
+ public ZonedDateTime getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * Sets the date and time at which this transaction event occurred.
+ *
+ * @param timestamp The date and time at which this transaction event occurred
+ */
+ public void setTimestamp(ZonedDateTime timestamp) {
+ if (!isValidTimestamp(timestamp)) {
+ throw new PropertyConstraintException(timestamp, "timestamp is invalid");
+ }
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * Returns whether the given timestamp is valid
+ *
+ * @param timestamp the timestamp to check the validity of
+ * @return {@code true} if timestamp is valid, {@code false} if not
+ */
+ private boolean isValidTimestamp(ZonedDateTime timestamp) {
+ return timestamp != null;
+ }
+
+ /**
+ * Gets reason the Charging Station sends this message to the CSMS
+ *
+ * @return Reason the Charging Station sends this message to the CSMS
+ */
+ public TriggerReasonEnum getTriggerReason() {
+ return triggerReason;
+ }
+
+ /**
+ * Sets reason the Charging Station sends this message to the CSMS
+ *
+ * @param triggerReason Reason the Charging Station sends this message to the CSMS
+ */
+ public void setTriggerReason(TriggerReasonEnum triggerReason) {
+ if (!isValidTriggerReason(triggerReason)) {
+ throw new PropertyConstraintException(triggerReason, "triggerReason is invalid");
+ }
+ this.triggerReason = triggerReason;
+ }
+
+ /**
+ * Returns whether the given triggerReason is valid
+ *
+ * @param triggerReason the triggerReason to check the validity of
+ * @return {@code true} if triggerReason is valid, {@code false} if not
+ */
+ private boolean isValidTriggerReason(TriggerReasonEnum triggerReason) {
+ return triggerReason != null;
+ }
+
+ /**
+ * Gets incremental sequence number, helps with determining if all messages of a transaction have
+ * been received.
+ *
+ * @return Incremental sequence number, helps with determining if all messages of a transaction
+ * have been received
+ */
+ public Integer getSeqNo() {
+ return seqNo;
+ }
+
+ /**
+ * Sets incremental sequence number, helps with determining if all messages of a transaction have
+ * been received.
+ *
+ * @param seqNo Incremental sequence number, helps with determining if all messages of a
+ * transaction have been received
+ */
+ public void setSeqNo(Integer seqNo) {
+ if (!isValidSeqNo(seqNo)) {
+ throw new PropertyConstraintException(seqNo, "seqNo is invalid");
+ }
+ this.seqNo = seqNo;
+ }
+
+ /**
+ * Returns whether the given seqNo is valid
+ *
+ * @param seqNo the seqNo to check the validity of
+ * @return {@code true} if seqNo is valid, {@code false} if not
+ */
+ private boolean isValidSeqNo(Integer seqNo) {
+ return seqNo != null;
+ }
+
+ /**
+ * Gets indication that this transaction event happened when the Charging Station was offline.
+ * Default = false, meaning: the event occurred when the Charging Station was online.
+ *
+ * @return Indication that this transaction event happened when the Charging Station was offline
+ */
+ public Boolean getOffline() {
+ return offline != null ? offline : false;
+ }
+
+ /**
+ * Sets indication that this transaction event happened when the Charging Station was offline.
+ * Default = false, meaning: the event occurred when the Charging Station was online.
+ *
+ * @param offline Indication that this transaction event happened when the Charging Station was
+ * offline
+ */
+ public void setOffline(@Nullable Boolean offline) {
+ this.offline = offline;
+ }
+
+ /**
+ * Adds indication that this transaction event happened when the Charging Station was offline.
+ * Default = false, meaning: the event occurred when the Charging Station was online.
+ *
+ * @param offline Indication that this transaction event happened when the Charging Station was
+ * offline
+ * @return this
+ */
+ public TransactionEventRequest withOffline(@Nullable Boolean offline) {
+ setOffline(offline);
+ return this;
+ }
+
+ /**
+ * Gets if the Charging Station is able to report the number of phases used, then it SHALL provide
+ * it. When omitted the CSMS may be able to determine the number of phases used via device
+ * management.
+ *
+ * @return If the Charging Station is able to report the number of phases used, then it SHALL
+ * provide it
+ */
+ @Nullable
+ public Integer getNumberOfPhasesUsed() {
+ return numberOfPhasesUsed;
+ }
+
+ /**
+ * Sets if the Charging Station is able to report the number of phases used, then it SHALL provide
+ * it. When omitted the CSMS may be able to determine the number of phases used via device
+ * management.
+ *
+ * @param numberOfPhasesUsed If the Charging Station is able to report the number of phases used,
+ * then it SHALL provide it
+ */
+ public void setNumberOfPhasesUsed(@Nullable Integer numberOfPhasesUsed) {
+ this.numberOfPhasesUsed = numberOfPhasesUsed;
+ }
+
+ /**
+ * Adds if the Charging Station is able to report the number of phases used, then it SHALL provide
+ * it. When omitted the CSMS may be able to determine the number of phases used via device
+ * management.
+ *
+ * @param numberOfPhasesUsed If the Charging Station is able to report the number of phases used,
+ * then it SHALL provide it
+ * @return this
+ */
+ public TransactionEventRequest withNumberOfPhasesUsed(@Nullable Integer numberOfPhasesUsed) {
+ setNumberOfPhasesUsed(numberOfPhasesUsed);
+ return this;
+ }
+
+ /**
+ * Gets the maximum current of the connected cable in Ampere (A).
+ *
+ * @return The maximum current of the connected cable in Ampere (A)
+ */
+ @Nullable
+ public Integer getCableMaxCurrent() {
+ return cableMaxCurrent;
+ }
+
+ /**
+ * Sets the maximum current of the connected cable in Ampere (A).
+ *
+ * @param cableMaxCurrent The maximum current of the connected cable in Ampere (A)
+ */
+ public void setCableMaxCurrent(@Nullable Integer cableMaxCurrent) {
+ this.cableMaxCurrent = cableMaxCurrent;
+ }
+
+ /**
+ * Adds the maximum current of the connected cable in Ampere (A).
+ *
+ * @param cableMaxCurrent The maximum current of the connected cable in Ampere (A)
+ * @return this
+ */
+ public TransactionEventRequest withCableMaxCurrent(@Nullable Integer cableMaxCurrent) {
+ setCableMaxCurrent(cableMaxCurrent);
+ return this;
+ }
+
+ /**
+ * Gets the Id of the reservation that terminates as a result of this transaction.
+ *
+ * @return The Id of the reservation that terminates as a result of this transaction
+ */
+ @Nullable
+ public Integer getReservationId() {
+ return reservationId;
+ }
+
+ /**
+ * Sets the Id of the reservation that terminates as a result of this transaction.
+ *
+ * @param reservationId The Id of the reservation that terminates as a result of this transaction
+ */
+ public void setReservationId(@Nullable Integer reservationId) {
+ this.reservationId = reservationId;
+ }
+
+ /**
+ * Adds the Id of the reservation that terminates as a result of this transaction.
+ *
+ * @param reservationId The Id of the reservation that terminates as a result of this transaction
+ * @return this
+ */
+ public TransactionEventRequest withReservationId(@Nullable Integer reservationId) {
+ setReservationId(reservationId);
+ return this;
+ }
+
+ /**
+ * Gets transaction
+ *
+ * @return Transaction
+ */
+ public Transaction getTransactionInfo() {
+ return transactionInfo;
+ }
+
+ /**
+ * Sets transaction
+ *
+ * @param transactionInfo Transaction
+ */
+ public void setTransactionInfo(Transaction transactionInfo) {
+ if (!isValidTransactionInfo(transactionInfo)) {
+ throw new PropertyConstraintException(transactionInfo, "transactionInfo is invalid");
+ }
+ this.transactionInfo = transactionInfo;
+ }
+
+ /**
+ * Returns whether the given transactionInfo is valid
+ *
+ * @param transactionInfo the transactionInfo to check the validity of
+ * @return {@code true} if transactionInfo is valid, {@code false} if not
+ */
+ private boolean isValidTransactionInfo(Transaction transactionInfo) {
+ return transactionInfo != null && transactionInfo.validate();
+ }
+
+ /**
+ * Gets electric Vehicle Supply Equipment
+ *
+ * @return Electric Vehicle Supply Equipment
+ */
+ @Nullable
+ public EVSE getEvse() {
+ return evse;
+ }
+
+ /**
+ * Sets electric Vehicle Supply Equipment
+ *
+ * @param evse Electric Vehicle Supply Equipment
+ */
+ public void setEvse(@Nullable EVSE evse) {
+ if (!isValidEvse(evse)) {
+ throw new PropertyConstraintException(evse, "evse is invalid");
+ }
+ this.evse = evse;
+ }
+
+ /**
+ * Returns whether the given evse is valid
+ *
+ * @param evse the evse to check the validity of
+ * @return {@code true} if evse is valid, {@code false} if not
+ */
+ private boolean isValidEvse(@Nullable EVSE evse) {
+ return evse == null || evse.validate();
+ }
+
+ /**
+ * Adds electric Vehicle Supply Equipment
+ *
+ * @param evse Electric Vehicle Supply Equipment
+ * @return this
+ */
+ public TransactionEventRequest withEvse(@Nullable EVSE evse) {
+ setEvse(evse);
+ return this;
+ }
+
+ /**
+ * Gets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @return A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ @Nullable
+ public IdToken getIdToken() {
+ return idToken;
+ }
+
+ /**
+ * Sets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param idToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public void setIdToken(@Nullable IdToken idToken) {
+ if (!isValidIdToken(idToken)) {
+ throw new PropertyConstraintException(idToken, "idToken is invalid");
+ }
+ this.idToken = idToken;
+ }
+
+ /**
+ * Returns whether the given idToken is valid
+ *
+ * @param idToken the idToken to check the validity of
+ * @return {@code true} if idToken is valid, {@code false} if not
+ */
+ private boolean isValidIdToken(@Nullable IdToken idToken) {
+ return idToken == null || idToken.validate();
+ }
+
+ /**
+ * Adds a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param idToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ * @return this
+ */
+ public TransactionEventRequest withIdToken(@Nullable IdToken idToken) {
+ setIdToken(idToken);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidEventType(eventType)
+ && isValidMeterValue(meterValue)
+ && isValidTimestamp(timestamp)
+ && isValidTriggerReason(triggerReason)
+ && isValidSeqNo(seqNo)
+ && isValidTransactionInfo(transactionInfo)
+ && isValidEvse(evse)
+ && isValidIdToken(idToken);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return true;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ TransactionEventRequest that = (TransactionEventRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(eventType, that.eventType)
+ && Arrays.equals(meterValue, that.meterValue)
+ && Objects.equals(timestamp, that.timestamp)
+ && Objects.equals(triggerReason, that.triggerReason)
+ && Objects.equals(seqNo, that.seqNo)
+ && Objects.equals(offline, that.offline)
+ && Objects.equals(numberOfPhasesUsed, that.numberOfPhasesUsed)
+ && Objects.equals(cableMaxCurrent, that.cableMaxCurrent)
+ && Objects.equals(reservationId, that.reservationId)
+ && Objects.equals(transactionInfo, that.transactionInfo)
+ && Objects.equals(evse, that.evse)
+ && Objects.equals(idToken, that.idToken);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ eventType,
+ Arrays.hashCode(meterValue),
+ timestamp,
+ triggerReason,
+ seqNo,
+ offline,
+ numberOfPhasesUsed,
+ cableMaxCurrent,
+ reservationId,
+ transactionInfo,
+ evse,
+ idToken);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("eventType", eventType)
+ .add("meterValue", meterValue)
+ .add("timestamp", timestamp)
+ .add("triggerReason", triggerReason)
+ .add("seqNo", seqNo)
+ .add("offline", offline)
+ .add("numberOfPhasesUsed", numberOfPhasesUsed)
+ .add("cableMaxCurrent", cableMaxCurrent)
+ .add("reservationId", reservationId)
+ .add("transactionInfo", transactionInfo)
+ .add("evse", evse)
+ .add("idToken", idToken)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/TransactionEventResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/TransactionEventResponse.java
new file mode 100644
index 000000000..735df87f7
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/TransactionEventResponse.java
@@ -0,0 +1,336 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.IdTokenInfo;
+import eu.chargetime.ocpp.v201.model.types.MessageContent;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * TransactionEventResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class TransactionEventResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * SHALL only be sent when charging has ended. Final total cost of this transaction, including
+ * taxes. In the currency configured with the Configuration Variable: `Currency`. When omitted,
+ * the transaction was NOT free. To indicate a free transaction, the CSMS SHALL send 0.00.
+ */
+ @Nullable private Double totalCost;
+
+ /**
+ * Priority from a business point of view. Default priority is 0, The range is from -9 to 9.
+ * Higher values indicate a higher priority. The chargingPriority in TransactionEventResponse is
+ * temporarily, so it may not be set in the IdTokenInfoType afterwards. Also the chargingPriority
+ * in TransactionEventResponse overrules the one in IdTokenInfoType.
+ */
+ @Nullable private Integer chargingPriority;
+
+ /**
+ * ID Token
+ *
+ * Status information about an identifier. It is advised to not stop charging for a token that
+ * expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is not
+ * given, the status has no end date.
+ */
+ @Nullable private IdTokenInfo idTokenInfo;
+
+ /**
+ * Message Content
+ *
+ * Message details, for a message to be displayed on a Charging Station.
+ */
+ @Nullable private MessageContent updatedPersonalMessage;
+
+ /** Constructor for the TransactionEventResponse class */
+ public TransactionEventResponse() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public TransactionEventResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets SHALL only be sent when charging has ended. Final total cost of this transaction,
+ * including taxes. In the currency configured with the Configuration Variable: `Currency`. When
+ * omitted, the transaction was NOT free. To indicate a free transaction, the CSMS SHALL send
+ * 0.00.
+ *
+ * @return SHALL only be sent when charging has ended
+ */
+ @Nullable
+ public Double getTotalCost() {
+ return totalCost;
+ }
+
+ /**
+ * Sets SHALL only be sent when charging has ended. Final total cost of this transaction,
+ * including taxes. In the currency configured with the Configuration Variable: `Currency`. When
+ * omitted, the transaction was NOT free. To indicate a free transaction, the CSMS SHALL send
+ * 0.00.
+ *
+ * @param totalCost SHALL only be sent when charging has ended
+ */
+ public void setTotalCost(@Nullable Double totalCost) {
+ this.totalCost = totalCost;
+ }
+
+ /**
+ * Adds SHALL only be sent when charging has ended. Final total cost of this transaction,
+ * including taxes. In the currency configured with the Configuration Variable: `Currency`. When
+ * omitted, the transaction was NOT free. To indicate a free transaction, the CSMS SHALL send
+ * 0.00.
+ *
+ * @param totalCost SHALL only be sent when charging has ended
+ * @return this
+ */
+ public TransactionEventResponse withTotalCost(@Nullable Double totalCost) {
+ setTotalCost(totalCost);
+ return this;
+ }
+
+ /**
+ * Gets priority from a business point of view. Default priority is 0, The range is from -9 to 9.
+ * Higher values indicate a higher priority. The chargingPriority in TransactionEventResponse is
+ * temporarily, so it may not be set in the IdTokenInfoType afterwards. Also the chargingPriority
+ * in TransactionEventResponse overrules the one in IdTokenInfoType.
+ *
+ * @return Priority from a business point of view
+ */
+ @Nullable
+ public Integer getChargingPriority() {
+ return chargingPriority;
+ }
+
+ /**
+ * Sets priority from a business point of view. Default priority is 0, The range is from -9 to 9.
+ * Higher values indicate a higher priority. The chargingPriority in TransactionEventResponse is
+ * temporarily, so it may not be set in the IdTokenInfoType afterwards. Also the chargingPriority
+ * in TransactionEventResponse overrules the one in IdTokenInfoType.
+ *
+ * @param chargingPriority Priority from a business point of view
+ */
+ public void setChargingPriority(@Nullable Integer chargingPriority) {
+ this.chargingPriority = chargingPriority;
+ }
+
+ /**
+ * Adds priority from a business point of view. Default priority is 0, The range is from -9 to 9.
+ * Higher values indicate a higher priority. The chargingPriority in TransactionEventResponse is
+ * temporarily, so it may not be set in the IdTokenInfoType afterwards. Also the chargingPriority
+ * in TransactionEventResponse overrules the one in IdTokenInfoType.
+ *
+ * @param chargingPriority Priority from a business point of view
+ * @return this
+ */
+ public TransactionEventResponse withChargingPriority(@Nullable Integer chargingPriority) {
+ setChargingPriority(chargingPriority);
+ return this;
+ }
+
+ /**
+ * Gets status information about an identifier. It is advised to not stop charging for a token
+ * that expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is
+ * not given, the status has no end date.
+ *
+ * @return Status information about an identifier
+ */
+ @Nullable
+ public IdTokenInfo getIdTokenInfo() {
+ return idTokenInfo;
+ }
+
+ /**
+ * Sets status information about an identifier. It is advised to not stop charging for a token
+ * that expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is
+ * not given, the status has no end date.
+ *
+ * @param idTokenInfo Status information about an identifier
+ */
+ public void setIdTokenInfo(@Nullable IdTokenInfo idTokenInfo) {
+ if (!isValidIdTokenInfo(idTokenInfo)) {
+ throw new PropertyConstraintException(idTokenInfo, "idTokenInfo is invalid");
+ }
+ this.idTokenInfo = idTokenInfo;
+ }
+
+ /**
+ * Returns whether the given idTokenInfo is valid
+ *
+ * @param idTokenInfo the idTokenInfo to check the validity of
+ * @return {@code true} if idTokenInfo is valid, {@code false} if not
+ */
+ private boolean isValidIdTokenInfo(@Nullable IdTokenInfo idTokenInfo) {
+ return idTokenInfo == null || idTokenInfo.validate();
+ }
+
+ /**
+ * Adds status information about an identifier. It is advised to not stop charging for a token
+ * that expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is
+ * not given, the status has no end date.
+ *
+ * @param idTokenInfo Status information about an identifier
+ * @return this
+ */
+ public TransactionEventResponse withIdTokenInfo(@Nullable IdTokenInfo idTokenInfo) {
+ setIdTokenInfo(idTokenInfo);
+ return this;
+ }
+
+ /**
+ * Gets message details, for a message to be displayed on a Charging Station.
+ *
+ * @return Message details, for a message to be displayed on a Charging Station
+ */
+ @Nullable
+ public MessageContent getUpdatedPersonalMessage() {
+ return updatedPersonalMessage;
+ }
+
+ /**
+ * Sets message details, for a message to be displayed on a Charging Station.
+ *
+ * @param updatedPersonalMessage Message details, for a message to be displayed on a Charging
+ * Station
+ */
+ public void setUpdatedPersonalMessage(@Nullable MessageContent updatedPersonalMessage) {
+ if (!isValidUpdatedPersonalMessage(updatedPersonalMessage)) {
+ throw new PropertyConstraintException(
+ updatedPersonalMessage, "updatedPersonalMessage is invalid");
+ }
+ this.updatedPersonalMessage = updatedPersonalMessage;
+ }
+
+ /**
+ * Returns whether the given updatedPersonalMessage is valid
+ *
+ * @param updatedPersonalMessage the updatedPersonalMessage to check the validity of
+ * @return {@code true} if updatedPersonalMessage is valid, {@code false} if not
+ */
+ private boolean isValidUpdatedPersonalMessage(@Nullable MessageContent updatedPersonalMessage) {
+ return updatedPersonalMessage == null || updatedPersonalMessage.validate();
+ }
+
+ /**
+ * Adds message details, for a message to be displayed on a Charging Station.
+ *
+ * @param updatedPersonalMessage Message details, for a message to be displayed on a Charging
+ * Station
+ * @return this
+ */
+ public TransactionEventResponse withUpdatedPersonalMessage(
+ @Nullable MessageContent updatedPersonalMessage) {
+ setUpdatedPersonalMessage(updatedPersonalMessage);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidIdTokenInfo(idTokenInfo)
+ && isValidUpdatedPersonalMessage(updatedPersonalMessage);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ TransactionEventResponse that = (TransactionEventResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(totalCost, that.totalCost)
+ && Objects.equals(chargingPriority, that.chargingPriority)
+ && Objects.equals(idTokenInfo, that.idTokenInfo)
+ && Objects.equals(updatedPersonalMessage, that.updatedPersonalMessage);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, totalCost, chargingPriority, idTokenInfo, updatedPersonalMessage);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("totalCost", totalCost)
+ .add("chargingPriority", chargingPriority)
+ .add("idTokenInfo", idTokenInfo)
+ .add("updatedPersonalMessage", updatedPersonalMessage)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/TriggerMessageRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/TriggerMessageRequest.java
new file mode 100644
index 000000000..f67ec5466
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/TriggerMessageRequest.java
@@ -0,0 +1,221 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.EVSE;
+import eu.chargetime.ocpp.v201.model.types.MessageTriggerEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * TriggerMessageRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class TriggerMessageRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * EVSE
+ *
+ * Electric Vehicle Supply Equipment
+ */
+ @Nullable private EVSE evse;
+
+ /** Type of message to be triggered. */
+ private MessageTriggerEnum requestedMessage;
+
+ /**
+ * Constructor for the TriggerMessageRequest class
+ *
+ * @param requestedMessage Type of message to be triggered.
+ */
+ public TriggerMessageRequest(MessageTriggerEnum requestedMessage) {
+ setRequestedMessage(requestedMessage);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public TriggerMessageRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets electric Vehicle Supply Equipment
+ *
+ * @return Electric Vehicle Supply Equipment
+ */
+ @Nullable
+ public EVSE getEvse() {
+ return evse;
+ }
+
+ /**
+ * Sets electric Vehicle Supply Equipment
+ *
+ * @param evse Electric Vehicle Supply Equipment
+ */
+ public void setEvse(@Nullable EVSE evse) {
+ if (!isValidEvse(evse)) {
+ throw new PropertyConstraintException(evse, "evse is invalid");
+ }
+ this.evse = evse;
+ }
+
+ /**
+ * Returns whether the given evse is valid
+ *
+ * @param evse the evse to check the validity of
+ * @return {@code true} if evse is valid, {@code false} if not
+ */
+ private boolean isValidEvse(@Nullable EVSE evse) {
+ return evse == null || evse.validate();
+ }
+
+ /**
+ * Adds electric Vehicle Supply Equipment
+ *
+ * @param evse Electric Vehicle Supply Equipment
+ * @return this
+ */
+ public TriggerMessageRequest withEvse(@Nullable EVSE evse) {
+ setEvse(evse);
+ return this;
+ }
+
+ /**
+ * Gets type of message to be triggered.
+ *
+ * @return Type of message to be triggered
+ */
+ public MessageTriggerEnum getRequestedMessage() {
+ return requestedMessage;
+ }
+
+ /**
+ * Sets type of message to be triggered.
+ *
+ * @param requestedMessage Type of message to be triggered
+ */
+ public void setRequestedMessage(MessageTriggerEnum requestedMessage) {
+ if (!isValidRequestedMessage(requestedMessage)) {
+ throw new PropertyConstraintException(requestedMessage, "requestedMessage is invalid");
+ }
+ this.requestedMessage = requestedMessage;
+ }
+
+ /**
+ * Returns whether the given requestedMessage is valid
+ *
+ * @param requestedMessage the requestedMessage to check the validity of
+ * @return {@code true} if requestedMessage is valid, {@code false} if not
+ */
+ private boolean isValidRequestedMessage(MessageTriggerEnum requestedMessage) {
+ return requestedMessage != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidEvse(evse)
+ && isValidRequestedMessage(requestedMessage);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ TriggerMessageRequest that = (TriggerMessageRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(evse, that.evse)
+ && Objects.equals(requestedMessage, that.requestedMessage);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, evse, requestedMessage);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("evse", evse)
+ .add("requestedMessage", requestedMessage)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/TriggerMessageResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/TriggerMessageResponse.java
new file mode 100644
index 000000000..f54a9f029
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/TriggerMessageResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import eu.chargetime.ocpp.v201.model.types.TriggerMessageStatusEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * TriggerMessageResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class TriggerMessageResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the Charging Station will send the requested notification or not. */
+ private TriggerMessageStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the TriggerMessageResponse class
+ *
+ * @param status Whether the Charging Station will send the requested notification or not.
+ */
+ public TriggerMessageResponse(TriggerMessageStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public TriggerMessageResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Charging Station will send the requested notification or not.
+ *
+ * @return Whether the Charging Station will send the requested notification or not
+ */
+ public TriggerMessageStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station will send the requested notification or not.
+ *
+ * @param status Whether the Charging Station will send the requested notification or not
+ */
+ public void setStatus(TriggerMessageStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(TriggerMessageStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public TriggerMessageResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ TriggerMessageResponse that = (TriggerMessageResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UnlockConnectorRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UnlockConnectorRequest.java
new file mode 100644
index 000000000..4c1f7478a
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UnlockConnectorRequest.java
@@ -0,0 +1,205 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * UnlockConnectorRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class UnlockConnectorRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The identifier of the EVSE for which a connector needs to be unlocked. */
+ private Integer evseId;
+
+ /** The identifier of the connector that needs to be unlocked. */
+ private Integer connectorId;
+
+ /**
+ * Constructor for the UnlockConnectorRequest class
+ *
+ * @param evseId The identifier of the EVSE for which a connector needs to be unlocked.
+ * @param connectorId The identifier of the connector that needs to be unlocked.
+ */
+ public UnlockConnectorRequest(Integer evseId, Integer connectorId) {
+ setEvseId(evseId);
+ setConnectorId(connectorId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public UnlockConnectorRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the identifier of the EVSE for which a connector needs to be unlocked.
+ *
+ * @return The identifier of the EVSE for which a connector needs to be unlocked
+ */
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets the identifier of the EVSE for which a connector needs to be unlocked.
+ *
+ * @param evseId The identifier of the EVSE for which a connector needs to be unlocked
+ */
+ public void setEvseId(Integer evseId) {
+ if (!isValidEvseId(evseId)) {
+ throw new PropertyConstraintException(evseId, "evseId is invalid");
+ }
+ this.evseId = evseId;
+ }
+
+ /**
+ * Returns whether the given evseId is valid
+ *
+ * @param evseId the evseId to check the validity of
+ * @return {@code true} if evseId is valid, {@code false} if not
+ */
+ private boolean isValidEvseId(Integer evseId) {
+ return evseId != null;
+ }
+
+ /**
+ * Gets the identifier of the connector that needs to be unlocked.
+ *
+ * @return The identifier of the connector that needs to be unlocked
+ */
+ public Integer getConnectorId() {
+ return connectorId;
+ }
+
+ /**
+ * Sets the identifier of the connector that needs to be unlocked.
+ *
+ * @param connectorId The identifier of the connector that needs to be unlocked
+ */
+ public void setConnectorId(Integer connectorId) {
+ if (!isValidConnectorId(connectorId)) {
+ throw new PropertyConstraintException(connectorId, "connectorId is invalid");
+ }
+ this.connectorId = connectorId;
+ }
+
+ /**
+ * Returns whether the given connectorId is valid
+ *
+ * @param connectorId the connectorId to check the validity of
+ * @return {@code true} if connectorId is valid, {@code false} if not
+ */
+ private boolean isValidConnectorId(Integer connectorId) {
+ return connectorId != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidEvseId(evseId)
+ && isValidConnectorId(connectorId);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ UnlockConnectorRequest that = (UnlockConnectorRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(evseId, that.evseId)
+ && Objects.equals(connectorId, that.connectorId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, evseId, connectorId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("evseId", evseId)
+ .add("connectorId", connectorId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UnlockConnectorResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UnlockConnectorResponse.java
new file mode 100644
index 000000000..37b298683
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UnlockConnectorResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import eu.chargetime.ocpp.v201.model.types.UnlockStatusEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * UnlockConnectorResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class UnlockConnectorResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the Charging Station has unlocked the connector. */
+ private UnlockStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the UnlockConnectorResponse class
+ *
+ * @param status Whether the Charging Station has unlocked the connector.
+ */
+ public UnlockConnectorResponse(UnlockStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public UnlockConnectorResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Charging Station has unlocked the connector.
+ *
+ * @return Whether the Charging Station has unlocked the connector
+ */
+ public UnlockStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Charging Station has unlocked the connector.
+ *
+ * @param status Whether the Charging Station has unlocked the connector
+ */
+ public void setStatus(UnlockStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(UnlockStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public UnlockConnectorResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ UnlockConnectorResponse that = (UnlockConnectorResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UnpublishFirmwareRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UnpublishFirmwareRequest.java
new file mode 100644
index 000000000..b689c17f7
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UnpublishFirmwareRequest.java
@@ -0,0 +1,166 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * UnpublishFirmwareRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class UnpublishFirmwareRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The MD5 checksum over the entire firmware file as a hexadecimal string of length 32. */
+ private String checksum;
+
+ /**
+ * Constructor for the UnpublishFirmwareRequest class
+ *
+ * @param checksum The MD5 checksum over the entire firmware file as a hexadecimal string of
+ * length 32.
+ */
+ public UnpublishFirmwareRequest(String checksum) {
+ setChecksum(checksum);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public UnpublishFirmwareRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
+ *
+ * @return The MD5 checksum over the entire firmware file as a hexadecimal string of length 32
+ */
+ public String getChecksum() {
+ return checksum;
+ }
+
+ /**
+ * Sets the MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
+ *
+ * @param checksum The MD5 checksum over the entire firmware file as a hexadecimal string of
+ * length 32
+ */
+ public void setChecksum(String checksum) {
+ if (!isValidChecksum(checksum)) {
+ throw new PropertyConstraintException(checksum, "checksum is invalid");
+ }
+ this.checksum = checksum;
+ }
+
+ /**
+ * Returns whether the given checksum is valid
+ *
+ * @param checksum the checksum to check the validity of
+ * @return {@code true} if checksum is valid, {@code false} if not
+ */
+ private boolean isValidChecksum(String checksum) {
+ return checksum != null && checksum.length() <= 32;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidChecksum(checksum);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ UnpublishFirmwareRequest that = (UnpublishFirmwareRequest) o;
+ return Objects.equals(customData, that.customData) && Objects.equals(checksum, that.checksum);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, checksum);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("checksum", checksum)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UnpublishFirmwareResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UnpublishFirmwareResponse.java
new file mode 100644
index 000000000..71a59da88
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UnpublishFirmwareResponse.java
@@ -0,0 +1,160 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.UnpublishFirmwareStatusEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * UnpublishFirmwareResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class UnpublishFirmwareResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Whether the Local Controller succeeded in unpublishing the firmware. */
+ private UnpublishFirmwareStatusEnum status;
+
+ /**
+ * Constructor for the UnpublishFirmwareResponse class
+ *
+ * @param status Whether the Local Controller succeeded in unpublishing the firmware.
+ */
+ public UnpublishFirmwareResponse(UnpublishFirmwareStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public UnpublishFirmwareResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets whether the Local Controller succeeded in unpublishing the firmware.
+ *
+ * @return Whether the Local Controller succeeded in unpublishing the firmware
+ */
+ public UnpublishFirmwareStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets whether the Local Controller succeeded in unpublishing the firmware.
+ *
+ * @param status Whether the Local Controller succeeded in unpublishing the firmware
+ */
+ public void setStatus(UnpublishFirmwareStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(UnpublishFirmwareStatusEnum status) {
+ return status != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ UnpublishFirmwareResponse that = (UnpublishFirmwareResponse) o;
+ return Objects.equals(customData, that.customData) && Objects.equals(status, that.status);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UpdateFirmwareRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UpdateFirmwareRequest.java
new file mode 100644
index 000000000..34cbf652e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UpdateFirmwareRequest.java
@@ -0,0 +1,298 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.Firmware;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * UpdateFirmwareRequest
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class UpdateFirmwareRequest extends RequestWithId {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * How many times Charging Station must try to download the firmware before giving up. If this
+ * field is not present, it is left to Charging Station to decide how many times it wants to
+ * retry.
+ */
+ @Nullable private Integer retries;
+
+ /**
+ * The interval in seconds after which a retry may be attempted. If this field is not present, it
+ * is left to Charging Station to decide how long to wait between attempts.
+ */
+ @Nullable private Integer retryInterval;
+
+ /** The Id of this request */
+ private Integer requestId;
+
+ /**
+ * Firmware
+ *
+ * A copy of the firmware that can be loaded/updated on the Charging Station.
+ */
+ private Firmware firmware;
+
+ /**
+ * Constructor for the UpdateFirmwareRequest class
+ *
+ * @param requestId The Id of this request
+ * @param firmware A copy of the firmware that can be loaded/updated on the Charging Station.
+ */
+ public UpdateFirmwareRequest(Integer requestId, Firmware firmware) {
+ setRequestId(requestId);
+ setFirmware(firmware);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public UpdateFirmwareRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets how many times Charging Station must try to download the firmware before giving up. If
+ * this field is not present, it is left to Charging Station to decide how many times it wants to
+ * retry.
+ *
+ * @return How many times Charging Station must try to download the firmware before giving up
+ */
+ @Nullable
+ public Integer getRetries() {
+ return retries;
+ }
+
+ /**
+ * Sets how many times Charging Station must try to download the firmware before giving up. If
+ * this field is not present, it is left to Charging Station to decide how many times it wants to
+ * retry.
+ *
+ * @param retries How many times Charging Station must try to download the firmware before giving
+ * up
+ */
+ public void setRetries(@Nullable Integer retries) {
+ this.retries = retries;
+ }
+
+ /**
+ * Adds how many times Charging Station must try to download the firmware before giving up. If
+ * this field is not present, it is left to Charging Station to decide how many times it wants to
+ * retry.
+ *
+ * @param retries How many times Charging Station must try to download the firmware before giving
+ * up
+ * @return this
+ */
+ public UpdateFirmwareRequest withRetries(@Nullable Integer retries) {
+ setRetries(retries);
+ return this;
+ }
+
+ /**
+ * Gets the interval in seconds after which a retry may be attempted. If this field is not
+ * present, it is left to Charging Station to decide how long to wait between attempts.
+ *
+ * @return The interval in seconds after which a retry may be attempted
+ */
+ @Nullable
+ public Integer getRetryInterval() {
+ return retryInterval;
+ }
+
+ /**
+ * Sets the interval in seconds after which a retry may be attempted. If this field is not
+ * present, it is left to Charging Station to decide how long to wait between attempts.
+ *
+ * @param retryInterval The interval in seconds after which a retry may be attempted
+ */
+ public void setRetryInterval(@Nullable Integer retryInterval) {
+ this.retryInterval = retryInterval;
+ }
+
+ /**
+ * Adds the interval in seconds after which a retry may be attempted. If this field is not
+ * present, it is left to Charging Station to decide how long to wait between attempts.
+ *
+ * @param retryInterval The interval in seconds after which a retry may be attempted
+ * @return this
+ */
+ public UpdateFirmwareRequest withRetryInterval(@Nullable Integer retryInterval) {
+ setRetryInterval(retryInterval);
+ return this;
+ }
+
+ /**
+ * Gets the Id of this request
+ *
+ * @return The Id of this request
+ */
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the Id of this request
+ *
+ * @param requestId The Id of this request
+ */
+ public void setRequestId(Integer requestId) {
+ if (!isValidRequestId(requestId)) {
+ throw new PropertyConstraintException(requestId, "requestId is invalid");
+ }
+ this.requestId = requestId;
+ }
+
+ /**
+ * Returns whether the given requestId is valid
+ *
+ * @param requestId the requestId to check the validity of
+ * @return {@code true} if requestId is valid, {@code false} if not
+ */
+ private boolean isValidRequestId(Integer requestId) {
+ return requestId != null;
+ }
+
+ /**
+ * Gets a copy of the firmware that can be loaded/updated on the Charging Station.
+ *
+ * @return A copy of the firmware that can be loaded/updated on the Charging Station
+ */
+ public Firmware getFirmware() {
+ return firmware;
+ }
+
+ /**
+ * Sets a copy of the firmware that can be loaded/updated on the Charging Station.
+ *
+ * @param firmware A copy of the firmware that can be loaded/updated on the Charging Station
+ */
+ public void setFirmware(Firmware firmware) {
+ if (!isValidFirmware(firmware)) {
+ throw new PropertyConstraintException(firmware, "firmware is invalid");
+ }
+ this.firmware = firmware;
+ }
+
+ /**
+ * Returns whether the given firmware is valid
+ *
+ * @param firmware the firmware to check the validity of
+ * @return {@code true} if firmware is valid, {@code false} if not
+ */
+ private boolean isValidFirmware(Firmware firmware) {
+ return firmware != null && firmware.validate();
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidRequestId(requestId)
+ && isValidFirmware(firmware);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ UpdateFirmwareRequest that = (UpdateFirmwareRequest) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(retries, that.retries)
+ && Objects.equals(retryInterval, that.retryInterval)
+ && Objects.equals(requestId, that.requestId)
+ && Objects.equals(firmware, that.firmware);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, retries, retryInterval, requestId, firmware);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("retries", retries)
+ .add("retryInterval", retryInterval)
+ .add("requestId", requestId)
+ .add("firmware", firmware)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UpdateFirmwareResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UpdateFirmwareResponse.java
new file mode 100644
index 000000000..63b9b68a4
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/UpdateFirmwareResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import eu.chargetime.ocpp.v201.model.types.UpdateFirmwareStatusEnum;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * UpdateFirmwareResponse
+ *
+ * OCPP 2.0.1 FINAL
+ */
+public final class UpdateFirmwareResponse extends Confirmation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** This field indicates whether the Charging Station was able to accept the request. */
+ private UpdateFirmwareStatusEnum status;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the UpdateFirmwareResponse class
+ *
+ * @param status This field indicates whether the Charging Station was able to accept the request.
+ */
+ public UpdateFirmwareResponse(UpdateFirmwareStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public UpdateFirmwareResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets this field indicates whether the Charging Station was able to accept the request.
+ *
+ * @return This field indicates whether the Charging Station was able to accept the request
+ */
+ public UpdateFirmwareStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets this field indicates whether the Charging Station was able to accept the request.
+ *
+ * @param status This field indicates whether the Charging Station was able to accept the request
+ */
+ public void setStatus(UpdateFirmwareStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(UpdateFirmwareStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public UpdateFirmwareResponse withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStatus(status) && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ UpdateFirmwareResponse that = (UpdateFirmwareResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ACChargingParameters.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ACChargingParameters.java
new file mode 100644
index 000000000..e271f536e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ACChargingParameters.java
@@ -0,0 +1,297 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * AC Charging Parameters
+ *
+ * EV AC charging parameters.
+ */
+public final class ACChargingParameters {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * AC Charging Parameters. Energy Amount. Energy Amount
+ *
+ * Amount of energy requested (in Wh). This includes energy required for preconditioning.
+ */
+ private Integer energyAmount;
+
+ /**
+ * AC Charging Parameters. EV Min. Current
+ *
+ * Minimum current (amps) supported by the electric vehicle (per phase).
+ */
+ private Integer evMinCurrent;
+
+ /**
+ * AC Charging Parameters. EV Max. Current
+ *
+ * Maximum current (amps) supported by the electric vehicle (per phase). Includes cable
+ * capacity.
+ */
+ private Integer evMaxCurrent;
+
+ /**
+ * AC Charging Parameters. EV Max. Voltage
+ *
+ * Maximum voltage supported by the electric vehicle
+ */
+ private Integer evMaxVoltage;
+
+ /**
+ * Constructor for the ACChargingParameters class
+ *
+ * @param energyAmount Amount of energy requested (in Wh). This includes energy required for
+ * preconditioning.
+ * @param evMinCurrent Minimum current (amps) supported by the electric vehicle (per phase).
+ * @param evMaxCurrent Maximum current (amps) supported by the electric vehicle (per phase).
+ * Includes cable capacity.
+ * @param evMaxVoltage Maximum voltage supported by the electric vehicle
+ */
+ public ACChargingParameters(
+ Integer energyAmount, Integer evMinCurrent, Integer evMaxCurrent, Integer evMaxVoltage) {
+ setEnergyAmount(energyAmount);
+ setEvMinCurrent(evMinCurrent);
+ setEvMaxCurrent(evMaxCurrent);
+ setEvMaxVoltage(evMaxVoltage);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ACChargingParameters withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets amount of energy requested (in Wh). This includes energy required for preconditioning.
+ *
+ * @return Amount of energy requested (in Wh)
+ */
+ public Integer getEnergyAmount() {
+ return energyAmount;
+ }
+
+ /**
+ * Sets amount of energy requested (in Wh). This includes energy required for preconditioning.
+ *
+ * @param energyAmount Amount of energy requested (in Wh)
+ */
+ public void setEnergyAmount(Integer energyAmount) {
+ if (!isValidEnergyAmount(energyAmount)) {
+ throw new PropertyConstraintException(energyAmount, "energyAmount is invalid");
+ }
+ this.energyAmount = energyAmount;
+ }
+
+ /**
+ * Returns whether the given energyAmount is valid
+ *
+ * @param energyAmount the energyAmount to check the validity of
+ * @return {@code true} if energyAmount is valid, {@code false} if not
+ */
+ private boolean isValidEnergyAmount(Integer energyAmount) {
+ return energyAmount != null;
+ }
+
+ /**
+ * Gets minimum current (amps) supported by the electric vehicle (per phase).
+ *
+ * @return Minimum current (amps) supported by the electric vehicle (per phase)
+ */
+ public Integer getEvMinCurrent() {
+ return evMinCurrent;
+ }
+
+ /**
+ * Sets minimum current (amps) supported by the electric vehicle (per phase).
+ *
+ * @param evMinCurrent Minimum current (amps) supported by the electric vehicle (per phase)
+ */
+ public void setEvMinCurrent(Integer evMinCurrent) {
+ if (!isValidEvMinCurrent(evMinCurrent)) {
+ throw new PropertyConstraintException(evMinCurrent, "evMinCurrent is invalid");
+ }
+ this.evMinCurrent = evMinCurrent;
+ }
+
+ /**
+ * Returns whether the given evMinCurrent is valid
+ *
+ * @param evMinCurrent the evMinCurrent to check the validity of
+ * @return {@code true} if evMinCurrent is valid, {@code false} if not
+ */
+ private boolean isValidEvMinCurrent(Integer evMinCurrent) {
+ return evMinCurrent != null;
+ }
+
+ /**
+ * Gets maximum current (amps) supported by the electric vehicle (per phase). Includes cable
+ * capacity.
+ *
+ * @return Maximum current (amps) supported by the electric vehicle (per phase)
+ */
+ public Integer getEvMaxCurrent() {
+ return evMaxCurrent;
+ }
+
+ /**
+ * Sets maximum current (amps) supported by the electric vehicle (per phase). Includes cable
+ * capacity.
+ *
+ * @param evMaxCurrent Maximum current (amps) supported by the electric vehicle (per phase)
+ */
+ public void setEvMaxCurrent(Integer evMaxCurrent) {
+ if (!isValidEvMaxCurrent(evMaxCurrent)) {
+ throw new PropertyConstraintException(evMaxCurrent, "evMaxCurrent is invalid");
+ }
+ this.evMaxCurrent = evMaxCurrent;
+ }
+
+ /**
+ * Returns whether the given evMaxCurrent is valid
+ *
+ * @param evMaxCurrent the evMaxCurrent to check the validity of
+ * @return {@code true} if evMaxCurrent is valid, {@code false} if not
+ */
+ private boolean isValidEvMaxCurrent(Integer evMaxCurrent) {
+ return evMaxCurrent != null;
+ }
+
+ /**
+ * Gets maximum voltage supported by the electric vehicle
+ *
+ * @return Maximum voltage supported by the electric vehicle
+ */
+ public Integer getEvMaxVoltage() {
+ return evMaxVoltage;
+ }
+
+ /**
+ * Sets maximum voltage supported by the electric vehicle
+ *
+ * @param evMaxVoltage Maximum voltage supported by the electric vehicle
+ */
+ public void setEvMaxVoltage(Integer evMaxVoltage) {
+ if (!isValidEvMaxVoltage(evMaxVoltage)) {
+ throw new PropertyConstraintException(evMaxVoltage, "evMaxVoltage is invalid");
+ }
+ this.evMaxVoltage = evMaxVoltage;
+ }
+
+ /**
+ * Returns whether the given evMaxVoltage is valid
+ *
+ * @param evMaxVoltage the evMaxVoltage to check the validity of
+ * @return {@code true} if evMaxVoltage is valid, {@code false} if not
+ */
+ private boolean isValidEvMaxVoltage(Integer evMaxVoltage) {
+ return evMaxVoltage != null;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidEnergyAmount(energyAmount)
+ && isValidEvMinCurrent(evMinCurrent)
+ && isValidEvMaxCurrent(evMaxCurrent)
+ && isValidEvMaxVoltage(evMaxVoltage);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ACChargingParameters that = (ACChargingParameters) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(energyAmount, that.energyAmount)
+ && Objects.equals(evMinCurrent, that.evMinCurrent)
+ && Objects.equals(evMaxCurrent, that.evMaxCurrent)
+ && Objects.equals(evMaxVoltage, that.evMaxVoltage);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, energyAmount, evMinCurrent, evMaxCurrent, evMaxVoltage);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("energyAmount", energyAmount)
+ .add("evMinCurrent", evMinCurrent)
+ .add("evMaxCurrent", evMaxCurrent)
+ .add("evMaxVoltage", evMaxVoltage)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/APN.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/APN.java
new file mode 100644
index 000000000..74b4ea1dc
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/APN.java
@@ -0,0 +1,459 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * APN
+ *
+ * Collection of configuration data needed to make a data-connection over a cellular network.
+ *
+ * NOTE: When asking a GSM modem to dial in, it is possible to specify which mobile operator
+ * should be used. This can be done with the mobile country code (MCC) in combination with a mobile
+ * network code (MNC). Example: If your preferred network is Vodafone Netherlands, the MCC=204 and
+ * the MNC=04 which means the key PreferredNetwork = 20404 Some modems allows to specify a preferred
+ * network, which means, if this network is not available, a different network is used. If you
+ * specify UseOnlyPreferredNetwork and this network is not available, the modem will not dial in.
+ */
+public final class APN {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * APN. APN. URI
+ *
+ * The Access Point Name as an URL.
+ */
+ private String apn;
+
+ /**
+ * APN. APN. User Name
+ *
+ * APN username.
+ */
+ @Nullable private String apnUserName;
+
+ /**
+ * APN. APN. Password
+ *
+ * APN Password.
+ */
+ @Nullable private String apnPassword;
+
+ /**
+ * APN. SIMPIN. PIN Code
+ *
+ * SIM card pin code.
+ */
+ @Nullable private Integer simPin;
+
+ /**
+ * APN. Preferred Network. Mobile Network ID
+ *
+ * Preferred network, written as MCC and MNC concatenated. See note.
+ */
+ @Nullable private String preferredNetwork;
+
+ /**
+ * APN. Use Only Preferred Network. Indicator
+ *
+ * Default: false. Use only the preferred Network, do not dial in when not available. See Note.
+ */
+ @Nullable private Boolean useOnlyPreferredNetwork;
+
+ /**
+ * APN. APN Authentication. APN Authentication Code
+ *
+ * Authentication method.
+ */
+ private APNAuthenticationEnum apnAuthentication;
+
+ /**
+ * Constructor for the APN class
+ *
+ * @param apn The Access Point Name as an URL.
+ * @param apnAuthentication Authentication method.
+ */
+ public APN(String apn, APNAuthenticationEnum apnAuthentication) {
+ setApn(apn);
+ setApnAuthentication(apnAuthentication);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public APN withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the Access Point Name as an URL.
+ *
+ * @return The Access Point Name as an URL
+ */
+ public String getApn() {
+ return apn;
+ }
+
+ /**
+ * Sets the Access Point Name as an URL.
+ *
+ * @param apn The Access Point Name as an URL
+ */
+ public void setApn(String apn) {
+ if (!isValidApn(apn)) {
+ throw new PropertyConstraintException(apn, "apn is invalid");
+ }
+ this.apn = apn;
+ }
+
+ /**
+ * Returns whether the given apn is valid
+ *
+ * @param apn the apn to check the validity of
+ * @return {@code true} if apn is valid, {@code false} if not
+ */
+ private boolean isValidApn(String apn) {
+ return apn != null && apn.length() <= 512;
+ }
+
+ /**
+ * Gets APN username.
+ *
+ * @return APN username
+ */
+ @Nullable
+ public String getApnUserName() {
+ return apnUserName;
+ }
+
+ /**
+ * Sets APN username.
+ *
+ * @param apnUserName APN username
+ */
+ public void setApnUserName(@Nullable String apnUserName) {
+ if (!isValidApnUserName(apnUserName)) {
+ throw new PropertyConstraintException(apnUserName, "apnUserName is invalid");
+ }
+ this.apnUserName = apnUserName;
+ }
+
+ /**
+ * Returns whether the given apnUserName is valid
+ *
+ * @param apnUserName the apnUserName to check the validity of
+ * @return {@code true} if apnUserName is valid, {@code false} if not
+ */
+ private boolean isValidApnUserName(@Nullable String apnUserName) {
+ return apnUserName == null || apnUserName.length() <= 20;
+ }
+
+ /**
+ * Adds APN username.
+ *
+ * @param apnUserName APN username
+ * @return this
+ */
+ public APN withApnUserName(@Nullable String apnUserName) {
+ setApnUserName(apnUserName);
+ return this;
+ }
+
+ /**
+ * Gets APN Password.
+ *
+ * @return APN Password
+ */
+ @Nullable
+ public String getApnPassword() {
+ return apnPassword;
+ }
+
+ /**
+ * Sets APN Password.
+ *
+ * @param apnPassword APN Password
+ */
+ public void setApnPassword(@Nullable String apnPassword) {
+ if (!isValidApnPassword(apnPassword)) {
+ throw new PropertyConstraintException(apnPassword, "apnPassword is invalid");
+ }
+ this.apnPassword = apnPassword;
+ }
+
+ /**
+ * Returns whether the given apnPassword is valid
+ *
+ * @param apnPassword the apnPassword to check the validity of
+ * @return {@code true} if apnPassword is valid, {@code false} if not
+ */
+ private boolean isValidApnPassword(@Nullable String apnPassword) {
+ return apnPassword == null || apnPassword.length() <= 20;
+ }
+
+ /**
+ * Adds APN Password.
+ *
+ * @param apnPassword APN Password
+ * @return this
+ */
+ public APN withApnPassword(@Nullable String apnPassword) {
+ setApnPassword(apnPassword);
+ return this;
+ }
+
+ /**
+ * Gets SIM card pin code.
+ *
+ * @return SIM card pin code
+ */
+ @Nullable
+ public Integer getSimPin() {
+ return simPin;
+ }
+
+ /**
+ * Sets SIM card pin code.
+ *
+ * @param simPin SIM card pin code
+ */
+ public void setSimPin(@Nullable Integer simPin) {
+ this.simPin = simPin;
+ }
+
+ /**
+ * Adds SIM card pin code.
+ *
+ * @param simPin SIM card pin code
+ * @return this
+ */
+ public APN withSimPin(@Nullable Integer simPin) {
+ setSimPin(simPin);
+ return this;
+ }
+
+ /**
+ * Gets preferred network, written as MCC and MNC concatenated. See note.
+ *
+ * @return Preferred network, written as MCC and MNC concatenated
+ */
+ @Nullable
+ public String getPreferredNetwork() {
+ return preferredNetwork;
+ }
+
+ /**
+ * Sets preferred network, written as MCC and MNC concatenated. See note.
+ *
+ * @param preferredNetwork Preferred network, written as MCC and MNC concatenated
+ */
+ public void setPreferredNetwork(@Nullable String preferredNetwork) {
+ if (!isValidPreferredNetwork(preferredNetwork)) {
+ throw new PropertyConstraintException(preferredNetwork, "preferredNetwork is invalid");
+ }
+ this.preferredNetwork = preferredNetwork;
+ }
+
+ /**
+ * Returns whether the given preferredNetwork is valid
+ *
+ * @param preferredNetwork the preferredNetwork to check the validity of
+ * @return {@code true} if preferredNetwork is valid, {@code false} if not
+ */
+ private boolean isValidPreferredNetwork(@Nullable String preferredNetwork) {
+ return preferredNetwork == null || preferredNetwork.length() <= 6;
+ }
+
+ /**
+ * Adds preferred network, written as MCC and MNC concatenated. See note.
+ *
+ * @param preferredNetwork Preferred network, written as MCC and MNC concatenated
+ * @return this
+ */
+ public APN withPreferredNetwork(@Nullable String preferredNetwork) {
+ setPreferredNetwork(preferredNetwork);
+ return this;
+ }
+
+ /**
+ * Gets default: false. Use only the preferred Network, do not dial in when not available. See
+ * Note.
+ *
+ * @return Default: false
+ */
+ public Boolean getUseOnlyPreferredNetwork() {
+ return useOnlyPreferredNetwork != null ? useOnlyPreferredNetwork : false;
+ }
+
+ /**
+ * Sets default: false. Use only the preferred Network, do not dial in when not available. See
+ * Note.
+ *
+ * @param useOnlyPreferredNetwork Default: false
+ */
+ public void setUseOnlyPreferredNetwork(@Nullable Boolean useOnlyPreferredNetwork) {
+ this.useOnlyPreferredNetwork = useOnlyPreferredNetwork;
+ }
+
+ /**
+ * Adds default: false. Use only the preferred Network, do not dial in when not available. See
+ * Note.
+ *
+ * @param useOnlyPreferredNetwork Default: false
+ * @return this
+ */
+ public APN withUseOnlyPreferredNetwork(@Nullable Boolean useOnlyPreferredNetwork) {
+ setUseOnlyPreferredNetwork(useOnlyPreferredNetwork);
+ return this;
+ }
+
+ /**
+ * Gets authentication method.
+ *
+ * @return Authentication method
+ */
+ public APNAuthenticationEnum getApnAuthentication() {
+ return apnAuthentication;
+ }
+
+ /**
+ * Sets authentication method.
+ *
+ * @param apnAuthentication Authentication method
+ */
+ public void setApnAuthentication(APNAuthenticationEnum apnAuthentication) {
+ if (!isValidApnAuthentication(apnAuthentication)) {
+ throw new PropertyConstraintException(apnAuthentication, "apnAuthentication is invalid");
+ }
+ this.apnAuthentication = apnAuthentication;
+ }
+
+ /**
+ * Returns whether the given apnAuthentication is valid
+ *
+ * @param apnAuthentication the apnAuthentication to check the validity of
+ * @return {@code true} if apnAuthentication is valid, {@code false} if not
+ */
+ private boolean isValidApnAuthentication(APNAuthenticationEnum apnAuthentication) {
+ return apnAuthentication != null;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidApn(apn)
+ && isValidApnUserName(apnUserName)
+ && isValidApnPassword(apnPassword)
+ && isValidPreferredNetwork(preferredNetwork)
+ && isValidApnAuthentication(apnAuthentication);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ APN that = (APN) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(apn, that.apn)
+ && Objects.equals(apnUserName, that.apnUserName)
+ && Objects.equals(apnPassword, that.apnPassword)
+ && Objects.equals(simPin, that.simPin)
+ && Objects.equals(preferredNetwork, that.preferredNetwork)
+ && Objects.equals(useOnlyPreferredNetwork, that.useOnlyPreferredNetwork)
+ && Objects.equals(apnAuthentication, that.apnAuthentication);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ apn,
+ apnUserName,
+ apnPassword,
+ simPin,
+ preferredNetwork,
+ useOnlyPreferredNetwork,
+ apnAuthentication);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("apn", apn)
+ .add("apnUserName", apnUserName)
+ .add("apnPassword", apnPassword)
+ .add("simPin", simPin)
+ .add("preferredNetwork", preferredNetwork)
+ .add("useOnlyPreferredNetwork", useOnlyPreferredNetwork)
+ .add("apnAuthentication", apnAuthentication)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/APNAuthenticationEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/APNAuthenticationEnum.java
new file mode 100644
index 000000000..584696120
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/APNAuthenticationEnum.java
@@ -0,0 +1,37 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * APN. APN Authentication. APN Authentication Code
+ *
+ * Authentication method.
+ */
+public enum APNAuthenticationEnum {
+ CHAP,
+ NONE,
+ PAP,
+ AUTO
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AdditionalInfo.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AdditionalInfo.java
new file mode 100644
index 000000000..73a2a16fb
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AdditionalInfo.java
@@ -0,0 +1,202 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * A case insensitive identifier to use for the authorization and the type of authorization to
+ * support multiple forms of identifiers.
+ */
+public final class AdditionalInfo {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The additional IdToken. */
+ private String additionalIdToken;
+
+ /**
+ * The type of the additionalIdToken. This is a custom type, so the implementation needs to be
+ * agreed upon by all involved parties.
+ */
+ private String type;
+
+ /**
+ * Constructor for the AdditionalInfo class
+ *
+ * @param additionalIdToken The additional IdToken.
+ * @param type The type of the additionalIdToken. This is a custom type, so the implementation
+ * needs to be agreed upon by all involved parties.
+ */
+ public AdditionalInfo(String additionalIdToken, String type) {
+ setAdditionalIdToken(additionalIdToken);
+ setType(type);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public AdditionalInfo withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the additional IdToken.
+ *
+ * @return The additional IdToken
+ */
+ public String getAdditionalIdToken() {
+ return additionalIdToken;
+ }
+
+ /**
+ * Sets the additional IdToken.
+ *
+ * @param additionalIdToken The additional IdToken
+ */
+ public void setAdditionalIdToken(String additionalIdToken) {
+ if (!isValidAdditionalIdToken(additionalIdToken)) {
+ throw new PropertyConstraintException(additionalIdToken, "additionalIdToken is invalid");
+ }
+ this.additionalIdToken = additionalIdToken;
+ }
+
+ /**
+ * Returns whether the given additionalIdToken is valid
+ *
+ * @param additionalIdToken the additionalIdToken to check the validity of
+ * @return {@code true} if additionalIdToken is valid, {@code false} if not
+ */
+ private boolean isValidAdditionalIdToken(String additionalIdToken) {
+ return additionalIdToken != null && additionalIdToken.length() <= 36;
+ }
+
+ /**
+ * Gets the type of the additionalIdToken. This is a custom type, so the implementation needs to
+ * be agreed upon by all involved parties.
+ *
+ * @return The type of the additionalIdToken
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type of the additionalIdToken. This is a custom type, so the implementation needs to
+ * be agreed upon by all involved parties.
+ *
+ * @param type The type of the additionalIdToken
+ */
+ public void setType(String type) {
+ if (!isValidType(type)) {
+ throw new PropertyConstraintException(type, "type is invalid");
+ }
+ this.type = type;
+ }
+
+ /**
+ * Returns whether the given type is valid
+ *
+ * @param type the type to check the validity of
+ * @return {@code true} if type is valid, {@code false} if not
+ */
+ private boolean isValidType(String type) {
+ return type != null && type.length() <= 50;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidAdditionalIdToken(additionalIdToken)
+ && isValidType(type);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ AdditionalInfo that = (AdditionalInfo) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(additionalIdToken, that.additionalIdToken)
+ && Objects.equals(type, that.type);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, additionalIdToken, type);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("additionalIdToken", additionalIdToken)
+ .add("type", type)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AttributeEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AttributeEnum.java
new file mode 100644
index 000000000..ba4c57c7a
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AttributeEnum.java
@@ -0,0 +1,33 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted. */
+public enum AttributeEnum {
+ Actual,
+ Target,
+ MinSet,
+ MaxSet
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AuthorizationData.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AuthorizationData.java
new file mode 100644
index 000000000..c3b49ad23
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AuthorizationData.java
@@ -0,0 +1,223 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** The identifier to use for authorization. */
+public final class AuthorizationData {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * A case insensitive identifier to use for the authorization and the type of authorization to
+ * support multiple forms of identifiers.
+ */
+ private IdToken idToken;
+
+ /**
+ * ID Token
+ *
+ * Status information about an identifier. It is advised to not stop charging for a token that
+ * expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is not
+ * given, the status has no end date.
+ */
+ @Nullable private IdTokenInfo idTokenInfo;
+
+ /**
+ * Constructor for the AuthorizationData class
+ *
+ * @param idToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers.
+ */
+ public AuthorizationData(IdToken idToken) {
+ setIdToken(idToken);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public AuthorizationData withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @return A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public IdToken getIdToken() {
+ return idToken;
+ }
+
+ /**
+ * Sets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param idToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public void setIdToken(IdToken idToken) {
+ if (!isValidIdToken(idToken)) {
+ throw new PropertyConstraintException(idToken, "idToken is invalid");
+ }
+ this.idToken = idToken;
+ }
+
+ /**
+ * Returns whether the given idToken is valid
+ *
+ * @param idToken the idToken to check the validity of
+ * @return {@code true} if idToken is valid, {@code false} if not
+ */
+ private boolean isValidIdToken(IdToken idToken) {
+ return idToken != null && idToken.validate();
+ }
+
+ /**
+ * Gets status information about an identifier. It is advised to not stop charging for a token
+ * that expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is
+ * not given, the status has no end date.
+ *
+ * @return Status information about an identifier
+ */
+ @Nullable
+ public IdTokenInfo getIdTokenInfo() {
+ return idTokenInfo;
+ }
+
+ /**
+ * Sets status information about an identifier. It is advised to not stop charging for a token
+ * that expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is
+ * not given, the status has no end date.
+ *
+ * @param idTokenInfo Status information about an identifier
+ */
+ public void setIdTokenInfo(@Nullable IdTokenInfo idTokenInfo) {
+ if (!isValidIdTokenInfo(idTokenInfo)) {
+ throw new PropertyConstraintException(idTokenInfo, "idTokenInfo is invalid");
+ }
+ this.idTokenInfo = idTokenInfo;
+ }
+
+ /**
+ * Returns whether the given idTokenInfo is valid
+ *
+ * @param idTokenInfo the idTokenInfo to check the validity of
+ * @return {@code true} if idTokenInfo is valid, {@code false} if not
+ */
+ private boolean isValidIdTokenInfo(@Nullable IdTokenInfo idTokenInfo) {
+ return idTokenInfo == null || idTokenInfo.validate();
+ }
+
+ /**
+ * Adds status information about an identifier. It is advised to not stop charging for a token
+ * that expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is
+ * not given, the status has no end date.
+ *
+ * @param idTokenInfo Status information about an identifier
+ * @return this
+ */
+ public AuthorizationData withIdTokenInfo(@Nullable IdTokenInfo idTokenInfo) {
+ setIdTokenInfo(idTokenInfo);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidIdToken(idToken)
+ && isValidIdTokenInfo(idTokenInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ AuthorizationData that = (AuthorizationData) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(idToken, that.idToken)
+ && Objects.equals(idTokenInfo, that.idTokenInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, idToken, idTokenInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("idToken", idToken)
+ .add("idTokenInfo", idTokenInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AuthorizationStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AuthorizationStatusEnum.java
new file mode 100644
index 000000000..3c97e77c1
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AuthorizationStatusEnum.java
@@ -0,0 +1,43 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * ID Token. Status. Authorization Status
+ *
+ * Current status of the ID Token.
+ */
+public enum AuthorizationStatusEnum {
+ Accepted,
+ Blocked,
+ ConcurrentTx,
+ Expired,
+ Invalid,
+ NoCredit,
+ NotAllowedTypeEVSE,
+ NotAtThisLocation,
+ NotAtThisTime,
+ Unknown
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AuthorizeCertificateStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AuthorizeCertificateStatusEnum.java
new file mode 100644
index 000000000..e27bc5055
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/AuthorizeCertificateStatusEnum.java
@@ -0,0 +1,43 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Certificate status information.
+ *
+ * The source of the charging limit.
+ */
+ private ChargingLimitSourceEnum chargingLimitSource;
+
+ /**
+ * Charging Limit. Is Grid Critical. Indicator
+ *
+ * Whether the charging limit is critical for the grid.
+ */
+ @Nullable private Boolean isGridCritical;
+
+ /**
+ * Constructor for the ChargingLimit class
+ *
+ * @param chargingLimitSource The source of the charging limit.
+ */
+ public ChargingLimit(ChargingLimitSourceEnum chargingLimitSource) {
+ setChargingLimitSource(chargingLimitSource);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ChargingLimit withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the source of the charging limit.
+ *
+ * @return The source of the charging limit
+ */
+ public ChargingLimitSourceEnum getChargingLimitSource() {
+ return chargingLimitSource;
+ }
+
+ /**
+ * Sets the source of the charging limit.
+ *
+ * @param chargingLimitSource The source of the charging limit
+ */
+ public void setChargingLimitSource(ChargingLimitSourceEnum chargingLimitSource) {
+ if (!isValidChargingLimitSource(chargingLimitSource)) {
+ throw new PropertyConstraintException(chargingLimitSource, "chargingLimitSource is invalid");
+ }
+ this.chargingLimitSource = chargingLimitSource;
+ }
+
+ /**
+ * Returns whether the given chargingLimitSource is valid
+ *
+ * @param chargingLimitSource the chargingLimitSource to check the validity of
+ * @return {@code true} if chargingLimitSource is valid, {@code false} if not
+ */
+ private boolean isValidChargingLimitSource(ChargingLimitSourceEnum chargingLimitSource) {
+ return chargingLimitSource != null;
+ }
+
+ /**
+ * Gets whether the charging limit is critical for the grid.
+ *
+ * @return Whether the charging limit is critical for the grid
+ */
+ @Nullable
+ public Boolean getIsGridCritical() {
+ return isGridCritical;
+ }
+
+ /**
+ * Sets whether the charging limit is critical for the grid.
+ *
+ * @param isGridCritical Whether the charging limit is critical for the grid
+ */
+ public void setIsGridCritical(@Nullable Boolean isGridCritical) {
+ this.isGridCritical = isGridCritical;
+ }
+
+ /**
+ * Adds whether the charging limit is critical for the grid.
+ *
+ * @param isGridCritical Whether the charging limit is critical for the grid
+ * @return this
+ */
+ public ChargingLimit withIsGridCritical(@Nullable Boolean isGridCritical) {
+ setIsGridCritical(isGridCritical);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidChargingLimitSource(chargingLimitSource);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ChargingLimit that = (ChargingLimit) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(chargingLimitSource, that.chargingLimitSource)
+ && Objects.equals(isGridCritical, that.isGridCritical);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, chargingLimitSource, isGridCritical);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("chargingLimitSource", chargingLimitSource)
+ .add("isGridCritical", isGridCritical)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingLimitSourceEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingLimitSourceEnum.java
new file mode 100644
index 000000000..602f72518
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingLimitSourceEnum.java
@@ -0,0 +1,33 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Source that has installed this charging profile. */
+public enum ChargingLimitSourceEnum {
+ EMS,
+ Other,
+ SO,
+ CSO
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingNeeds.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingNeeds.java
new file mode 100644
index 000000000..a3eb94b25
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingNeeds.java
@@ -0,0 +1,314 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Charging Needs */
+public final class ChargingNeeds {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * AC Charging Parameters
+ *
+ * EV AC charging parameters.
+ */
+ @Nullable private ACChargingParameters acChargingParameters;
+
+ /**
+ * DC Charging Parameters
+ *
+ * EV DC charging parameters
+ */
+ @Nullable private DCChargingParameters dcChargingParameters;
+
+ /**
+ * Charging Needs. Requested. Energy Transfer Mode Code
+ *
+ * Mode of energy transfer requested by the EV.
+ */
+ private EnergyTransferModeEnum requestedEnergyTransfer;
+
+ /**
+ * Charging Needs. Departure Time. Date Time
+ *
+ * Estimated departure time of the EV.
+ */
+ @Nullable private ZonedDateTime departureTime;
+
+ /**
+ * Constructor for the ChargingNeeds class
+ *
+ * @param requestedEnergyTransfer Mode of energy transfer requested by the EV.
+ */
+ public ChargingNeeds(EnergyTransferModeEnum requestedEnergyTransfer) {
+ setRequestedEnergyTransfer(requestedEnergyTransfer);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ChargingNeeds withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets EV AC charging parameters.
+ *
+ * @return EV AC charging parameters
+ */
+ @Nullable
+ public ACChargingParameters getAcChargingParameters() {
+ return acChargingParameters;
+ }
+
+ /**
+ * Sets EV AC charging parameters.
+ *
+ * @param acChargingParameters EV AC charging parameters
+ */
+ public void setAcChargingParameters(@Nullable ACChargingParameters acChargingParameters) {
+ if (!isValidAcChargingParameters(acChargingParameters)) {
+ throw new PropertyConstraintException(
+ acChargingParameters, "acChargingParameters is invalid");
+ }
+ this.acChargingParameters = acChargingParameters;
+ }
+
+ /**
+ * Returns whether the given acChargingParameters is valid
+ *
+ * @param acChargingParameters the acChargingParameters to check the validity of
+ * @return {@code true} if acChargingParameters is valid, {@code false} if not
+ */
+ private boolean isValidAcChargingParameters(@Nullable ACChargingParameters acChargingParameters) {
+ return acChargingParameters == null || acChargingParameters.validate();
+ }
+
+ /**
+ * Adds EV AC charging parameters.
+ *
+ * @param acChargingParameters EV AC charging parameters
+ * @return this
+ */
+ public ChargingNeeds withAcChargingParameters(
+ @Nullable ACChargingParameters acChargingParameters) {
+ setAcChargingParameters(acChargingParameters);
+ return this;
+ }
+
+ /**
+ * Gets EV DC charging parameters
+ *
+ * @return EV DC charging parameters
+ */
+ @Nullable
+ public DCChargingParameters getDcChargingParameters() {
+ return dcChargingParameters;
+ }
+
+ /**
+ * Sets EV DC charging parameters
+ *
+ * @param dcChargingParameters EV DC charging parameters
+ */
+ public void setDcChargingParameters(@Nullable DCChargingParameters dcChargingParameters) {
+ if (!isValidDcChargingParameters(dcChargingParameters)) {
+ throw new PropertyConstraintException(
+ dcChargingParameters, "dcChargingParameters is invalid");
+ }
+ this.dcChargingParameters = dcChargingParameters;
+ }
+
+ /**
+ * Returns whether the given dcChargingParameters is valid
+ *
+ * @param dcChargingParameters the dcChargingParameters to check the validity of
+ * @return {@code true} if dcChargingParameters is valid, {@code false} if not
+ */
+ private boolean isValidDcChargingParameters(@Nullable DCChargingParameters dcChargingParameters) {
+ return dcChargingParameters == null || dcChargingParameters.validate();
+ }
+
+ /**
+ * Adds EV DC charging parameters
+ *
+ * @param dcChargingParameters EV DC charging parameters
+ * @return this
+ */
+ public ChargingNeeds withDcChargingParameters(
+ @Nullable DCChargingParameters dcChargingParameters) {
+ setDcChargingParameters(dcChargingParameters);
+ return this;
+ }
+
+ /**
+ * Gets mode of energy transfer requested by the EV.
+ *
+ * @return Mode of energy transfer requested by the EV
+ */
+ public EnergyTransferModeEnum getRequestedEnergyTransfer() {
+ return requestedEnergyTransfer;
+ }
+
+ /**
+ * Sets mode of energy transfer requested by the EV.
+ *
+ * @param requestedEnergyTransfer Mode of energy transfer requested by the EV
+ */
+ public void setRequestedEnergyTransfer(EnergyTransferModeEnum requestedEnergyTransfer) {
+ if (!isValidRequestedEnergyTransfer(requestedEnergyTransfer)) {
+ throw new PropertyConstraintException(
+ requestedEnergyTransfer, "requestedEnergyTransfer is invalid");
+ }
+ this.requestedEnergyTransfer = requestedEnergyTransfer;
+ }
+
+ /**
+ * Returns whether the given requestedEnergyTransfer is valid
+ *
+ * @param requestedEnergyTransfer the requestedEnergyTransfer to check the validity of
+ * @return {@code true} if requestedEnergyTransfer is valid, {@code false} if not
+ */
+ private boolean isValidRequestedEnergyTransfer(EnergyTransferModeEnum requestedEnergyTransfer) {
+ return requestedEnergyTransfer != null;
+ }
+
+ /**
+ * Gets estimated departure time of the EV.
+ *
+ * @return Estimated departure time of the EV
+ */
+ @Nullable
+ public ZonedDateTime getDepartureTime() {
+ return departureTime;
+ }
+
+ /**
+ * Sets estimated departure time of the EV.
+ *
+ * @param departureTime Estimated departure time of the EV
+ */
+ public void setDepartureTime(@Nullable ZonedDateTime departureTime) {
+ this.departureTime = departureTime;
+ }
+
+ /**
+ * Adds estimated departure time of the EV.
+ *
+ * @param departureTime Estimated departure time of the EV
+ * @return this
+ */
+ public ChargingNeeds withDepartureTime(@Nullable ZonedDateTime departureTime) {
+ setDepartureTime(departureTime);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidAcChargingParameters(acChargingParameters)
+ && isValidDcChargingParameters(dcChargingParameters)
+ && isValidRequestedEnergyTransfer(requestedEnergyTransfer);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ChargingNeeds that = (ChargingNeeds) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(acChargingParameters, that.acChargingParameters)
+ && Objects.equals(dcChargingParameters, that.dcChargingParameters)
+ && Objects.equals(requestedEnergyTransfer, that.requestedEnergyTransfer)
+ && Objects.equals(departureTime, that.departureTime);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ acChargingParameters,
+ dcChargingParameters,
+ requestedEnergyTransfer,
+ departureTime);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("acChargingParameters", acChargingParameters)
+ .add("dcChargingParameters", dcChargingParameters)
+ .add("requestedEnergyTransfer", requestedEnergyTransfer)
+ .add("departureTime", departureTime)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfile.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfile.java
new file mode 100644
index 000000000..d4c9c14d2
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfile.java
@@ -0,0 +1,546 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.time.ZonedDateTime;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Charging Profile
+ *
+ * A ChargingProfile consists of ChargingSchedule, describing the amount of power or current that
+ * can be delivered per time interval.
+ */
+public final class ChargingProfile {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Identified Object. MRID. Numeric Identifier
+ *
+ * Id of ChargingProfile.
+ */
+ private Integer id;
+
+ /**
+ * Charging Profile. Stack Level. Counter
+ *
+ * Value determining level in hierarchy stack of profiles. Higher values have precedence over
+ * lower values. Lowest level is 0.
+ */
+ private Integer stackLevel;
+
+ /**
+ * Charging Profile. Charging Profile Purpose. Charging Profile Purpose Code
+ *
+ * The purpose of the schedule transferred by this profile
+ */
+ private ChargingProfilePurposeEnum chargingProfilePurpose;
+
+ /**
+ * Charging Profile. Charging Profile Kind. Charging Profile Kind Code
+ *
+ * The kind of schedule.
+ */
+ private ChargingProfileKindEnum chargingProfileKind;
+
+ /**
+ * Charging Profile. Recurrency Kind. Recurrency Kind Code
+ *
+ * The start point of a recurrence.
+ */
+ @Nullable private RecurrencyKindEnum recurrencyKind;
+
+ /**
+ * Charging Profile. Valid From. Date Time
+ *
+ * Point in time at which the profile starts to be valid. If absent, the profile is valid as
+ * soon as it is received by the Charging Station.
+ */
+ @Nullable private ZonedDateTime validFrom;
+
+ /**
+ * Charging Profile. Valid To. Date Time
+ *
+ * Point in time at which the profile stops to be valid. If absent, the profile is valid until
+ * it is replaced by another profile.
+ */
+ @Nullable private ZonedDateTime validTo;
+
+ /**
+ * Charging Schedule
+ *
+ * Charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile.
+ */
+ private ChargingSchedule[] chargingSchedule;
+
+ /**
+ * SHALL only be included if ChargingProfilePurpose is set to TxProfile. The transactionId is used
+ * to match the profile to a specific transaction.
+ */
+ @Nullable private String transactionId;
+
+ /**
+ * Constructor for the ChargingProfile class
+ *
+ * @param id Id of ChargingProfile.
+ * @param stackLevel Value determining level in hierarchy stack of profiles. Higher values have
+ * precedence over lower values. Lowest level is 0.
+ * @param chargingProfilePurpose The purpose of the schedule transferred by this profile
+ * @param chargingProfileKind The kind of schedule.
+ * @param chargingSchedule Charging schedule structure defines a list of charging periods, as used
+ * in: GetCompositeSchedule.conf and ChargingProfile.
+ */
+ public ChargingProfile(
+ Integer id,
+ Integer stackLevel,
+ ChargingProfilePurposeEnum chargingProfilePurpose,
+ ChargingProfileKindEnum chargingProfileKind,
+ ChargingSchedule[] chargingSchedule) {
+ setId(id);
+ setStackLevel(stackLevel);
+ setChargingProfilePurpose(chargingProfilePurpose);
+ setChargingProfileKind(chargingProfileKind);
+ setChargingSchedule(chargingSchedule);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ChargingProfile withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets id of ChargingProfile.
+ *
+ * @return Id of ChargingProfile
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * Sets id of ChargingProfile.
+ *
+ * @param id Id of ChargingProfile
+ */
+ public void setId(Integer id) {
+ if (!isValidId(id)) {
+ throw new PropertyConstraintException(id, "id is invalid");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Returns whether the given id is valid
+ *
+ * @param id the id to check the validity of
+ * @return {@code true} if id is valid, {@code false} if not
+ */
+ private boolean isValidId(Integer id) {
+ return id != null;
+ }
+
+ /**
+ * Gets value determining level in hierarchy stack of profiles. Higher values have precedence over
+ * lower values. Lowest level is 0.
+ *
+ * @return Value determining level in hierarchy stack of profiles
+ */
+ public Integer getStackLevel() {
+ return stackLevel;
+ }
+
+ /**
+ * Sets value determining level in hierarchy stack of profiles. Higher values have precedence over
+ * lower values. Lowest level is 0.
+ *
+ * @param stackLevel Value determining level in hierarchy stack of profiles
+ */
+ public void setStackLevel(Integer stackLevel) {
+ if (!isValidStackLevel(stackLevel)) {
+ throw new PropertyConstraintException(stackLevel, "stackLevel is invalid");
+ }
+ this.stackLevel = stackLevel;
+ }
+
+ /**
+ * Returns whether the given stackLevel is valid
+ *
+ * @param stackLevel the stackLevel to check the validity of
+ * @return {@code true} if stackLevel is valid, {@code false} if not
+ */
+ private boolean isValidStackLevel(Integer stackLevel) {
+ return stackLevel != null;
+ }
+
+ /**
+ * Gets the purpose of the schedule transferred by this profile
+ *
+ * @return The purpose of the schedule transferred by this profile
+ */
+ public ChargingProfilePurposeEnum getChargingProfilePurpose() {
+ return chargingProfilePurpose;
+ }
+
+ /**
+ * Sets the purpose of the schedule transferred by this profile
+ *
+ * @param chargingProfilePurpose The purpose of the schedule transferred by this profile
+ */
+ public void setChargingProfilePurpose(ChargingProfilePurposeEnum chargingProfilePurpose) {
+ if (!isValidChargingProfilePurpose(chargingProfilePurpose)) {
+ throw new PropertyConstraintException(
+ chargingProfilePurpose, "chargingProfilePurpose is invalid");
+ }
+ this.chargingProfilePurpose = chargingProfilePurpose;
+ }
+
+ /**
+ * Returns whether the given chargingProfilePurpose is valid
+ *
+ * @param chargingProfilePurpose the chargingProfilePurpose to check the validity of
+ * @return {@code true} if chargingProfilePurpose is valid, {@code false} if not
+ */
+ private boolean isValidChargingProfilePurpose(ChargingProfilePurposeEnum chargingProfilePurpose) {
+ return chargingProfilePurpose != null;
+ }
+
+ /**
+ * Gets the kind of schedule.
+ *
+ * @return The kind of schedule
+ */
+ public ChargingProfileKindEnum getChargingProfileKind() {
+ return chargingProfileKind;
+ }
+
+ /**
+ * Sets the kind of schedule.
+ *
+ * @param chargingProfileKind The kind of schedule
+ */
+ public void setChargingProfileKind(ChargingProfileKindEnum chargingProfileKind) {
+ if (!isValidChargingProfileKind(chargingProfileKind)) {
+ throw new PropertyConstraintException(chargingProfileKind, "chargingProfileKind is invalid");
+ }
+ this.chargingProfileKind = chargingProfileKind;
+ }
+
+ /**
+ * Returns whether the given chargingProfileKind is valid
+ *
+ * @param chargingProfileKind the chargingProfileKind to check the validity of
+ * @return {@code true} if chargingProfileKind is valid, {@code false} if not
+ */
+ private boolean isValidChargingProfileKind(ChargingProfileKindEnum chargingProfileKind) {
+ return chargingProfileKind != null;
+ }
+
+ /**
+ * Gets the start point of a recurrence.
+ *
+ * @return The start point of a recurrence
+ */
+ @Nullable
+ public RecurrencyKindEnum getRecurrencyKind() {
+ return recurrencyKind;
+ }
+
+ /**
+ * Sets the start point of a recurrence.
+ *
+ * @param recurrencyKind The start point of a recurrence
+ */
+ public void setRecurrencyKind(@Nullable RecurrencyKindEnum recurrencyKind) {
+ this.recurrencyKind = recurrencyKind;
+ }
+
+ /**
+ * Adds the start point of a recurrence.
+ *
+ * @param recurrencyKind The start point of a recurrence
+ * @return this
+ */
+ public ChargingProfile withRecurrencyKind(@Nullable RecurrencyKindEnum recurrencyKind) {
+ setRecurrencyKind(recurrencyKind);
+ return this;
+ }
+
+ /**
+ * Gets point in time at which the profile starts to be valid. If absent, the profile is valid as
+ * soon as it is received by the Charging Station.
+ *
+ * @return Point in time at which the profile starts to be valid
+ */
+ @Nullable
+ public ZonedDateTime getValidFrom() {
+ return validFrom;
+ }
+
+ /**
+ * Sets point in time at which the profile starts to be valid. If absent, the profile is valid as
+ * soon as it is received by the Charging Station.
+ *
+ * @param validFrom Point in time at which the profile starts to be valid
+ */
+ public void setValidFrom(@Nullable ZonedDateTime validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ /**
+ * Adds point in time at which the profile starts to be valid. If absent, the profile is valid as
+ * soon as it is received by the Charging Station.
+ *
+ * @param validFrom Point in time at which the profile starts to be valid
+ * @return this
+ */
+ public ChargingProfile withValidFrom(@Nullable ZonedDateTime validFrom) {
+ setValidFrom(validFrom);
+ return this;
+ }
+
+ /**
+ * Gets point in time at which the profile stops to be valid. If absent, the profile is valid
+ * until it is replaced by another profile.
+ *
+ * @return Point in time at which the profile stops to be valid
+ */
+ @Nullable
+ public ZonedDateTime getValidTo() {
+ return validTo;
+ }
+
+ /**
+ * Sets point in time at which the profile stops to be valid. If absent, the profile is valid
+ * until it is replaced by another profile.
+ *
+ * @param validTo Point in time at which the profile stops to be valid
+ */
+ public void setValidTo(@Nullable ZonedDateTime validTo) {
+ this.validTo = validTo;
+ }
+
+ /**
+ * Adds point in time at which the profile stops to be valid. If absent, the profile is valid
+ * until it is replaced by another profile.
+ *
+ * @param validTo Point in time at which the profile stops to be valid
+ * @return this
+ */
+ public ChargingProfile withValidTo(@Nullable ZonedDateTime validTo) {
+ setValidTo(validTo);
+ return this;
+ }
+
+ /**
+ * Gets charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile.
+ *
+ * @return Charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile
+ */
+ public ChargingSchedule[] getChargingSchedule() {
+ return chargingSchedule;
+ }
+
+ /**
+ * Sets charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile.
+ *
+ * @param chargingSchedule Charging schedule structure defines a list of charging periods, as used
+ * in: GetCompositeSchedule.conf and ChargingProfile
+ */
+ public void setChargingSchedule(ChargingSchedule[] chargingSchedule) {
+ if (!isValidChargingSchedule(chargingSchedule)) {
+ throw new PropertyConstraintException(chargingSchedule, "chargingSchedule is invalid");
+ }
+ this.chargingSchedule = chargingSchedule;
+ }
+
+ /**
+ * Returns whether the given chargingSchedule is valid
+ *
+ * @param chargingSchedule the chargingSchedule to check the validity of
+ * @return {@code true} if chargingSchedule is valid, {@code false} if not
+ */
+ private boolean isValidChargingSchedule(ChargingSchedule[] chargingSchedule) {
+ return chargingSchedule != null
+ && chargingSchedule.length >= 1
+ && chargingSchedule.length <= 3
+ && Arrays.stream(chargingSchedule).allMatch(item -> item.validate());
+ }
+
+ /**
+ * Gets SHALL only be included if ChargingProfilePurpose is set to TxProfile. The transactionId is
+ * used to match the profile to a specific transaction.
+ *
+ * @return SHALL only be included if ChargingProfilePurpose is set to TxProfile
+ */
+ @Nullable
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ /**
+ * Sets SHALL only be included if ChargingProfilePurpose is set to TxProfile. The transactionId is
+ * used to match the profile to a specific transaction.
+ *
+ * @param transactionId SHALL only be included if ChargingProfilePurpose is set to TxProfile
+ */
+ public void setTransactionId(@Nullable String transactionId) {
+ if (!isValidTransactionId(transactionId)) {
+ throw new PropertyConstraintException(transactionId, "transactionId is invalid");
+ }
+ this.transactionId = transactionId;
+ }
+
+ /**
+ * Returns whether the given transactionId is valid
+ *
+ * @param transactionId the transactionId to check the validity of
+ * @return {@code true} if transactionId is valid, {@code false} if not
+ */
+ private boolean isValidTransactionId(@Nullable String transactionId) {
+ return transactionId == null || transactionId.length() <= 36;
+ }
+
+ /**
+ * Adds SHALL only be included if ChargingProfilePurpose is set to TxProfile. The transactionId is
+ * used to match the profile to a specific transaction.
+ *
+ * @param transactionId SHALL only be included if ChargingProfilePurpose is set to TxProfile
+ * @return this
+ */
+ public ChargingProfile withTransactionId(@Nullable String transactionId) {
+ setTransactionId(transactionId);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidId(id)
+ && isValidStackLevel(stackLevel)
+ && isValidChargingProfilePurpose(chargingProfilePurpose)
+ && isValidChargingProfileKind(chargingProfileKind)
+ && isValidChargingSchedule(chargingSchedule)
+ && isValidTransactionId(transactionId);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ChargingProfile that = (ChargingProfile) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(id, that.id)
+ && Objects.equals(stackLevel, that.stackLevel)
+ && Objects.equals(chargingProfilePurpose, that.chargingProfilePurpose)
+ && Objects.equals(chargingProfileKind, that.chargingProfileKind)
+ && Objects.equals(recurrencyKind, that.recurrencyKind)
+ && Objects.equals(validFrom, that.validFrom)
+ && Objects.equals(validTo, that.validTo)
+ && Arrays.equals(chargingSchedule, that.chargingSchedule)
+ && Objects.equals(transactionId, that.transactionId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ id,
+ stackLevel,
+ chargingProfilePurpose,
+ chargingProfileKind,
+ recurrencyKind,
+ validFrom,
+ validTo,
+ Arrays.hashCode(chargingSchedule),
+ transactionId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("id", id)
+ .add("stackLevel", stackLevel)
+ .add("chargingProfilePurpose", chargingProfilePurpose)
+ .add("chargingProfileKind", chargingProfileKind)
+ .add("recurrencyKind", recurrencyKind)
+ .add("validFrom", validFrom)
+ .add("validTo", validTo)
+ .add("chargingSchedule", chargingSchedule)
+ .add("transactionId", transactionId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfileCriterion.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfileCriterion.java
new file mode 100644
index 000000000..9b0553a30
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfileCriterion.java
@@ -0,0 +1,329 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Charging Profile
+ *
+ * A ChargingProfile consists of ChargingSchedule, describing the amount of power or current that
+ * can be delivered per time interval.
+ */
+public final class ChargingProfileCriterion {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Charging Profile. Charging Profile Purpose. Charging Profile Purpose Code
+ *
+ * The purpose of the schedule transferred by this profile
+ */
+ @Nullable private ChargingProfilePurposeEnum chargingProfilePurpose;
+
+ /**
+ * Charging Profile. Stack Level. Counter
+ *
+ * Value determining level in hierarchy stack of profiles. Higher values have precedence over
+ * lower values. Lowest level is 0.
+ */
+ @Nullable private Integer stackLevel;
+
+ /**
+ * List of all the chargingProfileIds requested. Any ChargingProfile that matches one of these
+ * profiles will be reported. If omitted, the Charging Station SHALL not filter on
+ * chargingProfileId. This field SHALL NOT contain more ids than set in
+ * ChargingProfileEntries.maxLimit
+ */
+ @Nullable private Integer[] chargingProfileId;
+
+ /**
+ * For which charging limit sources, charging profiles SHALL be reported. If omitted, the Charging
+ * Station SHALL not filter on chargingLimitSource.
+ */
+ @Nullable private ChargingLimitSourceEnum[] chargingLimitSource;
+
+ /** Constructor for the ChargingProfileCriterion class */
+ public ChargingProfileCriterion() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ChargingProfileCriterion withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the purpose of the schedule transferred by this profile
+ *
+ * @return The purpose of the schedule transferred by this profile
+ */
+ @Nullable
+ public ChargingProfilePurposeEnum getChargingProfilePurpose() {
+ return chargingProfilePurpose;
+ }
+
+ /**
+ * Sets the purpose of the schedule transferred by this profile
+ *
+ * @param chargingProfilePurpose The purpose of the schedule transferred by this profile
+ */
+ public void setChargingProfilePurpose(
+ @Nullable ChargingProfilePurposeEnum chargingProfilePurpose) {
+ this.chargingProfilePurpose = chargingProfilePurpose;
+ }
+
+ /**
+ * Adds the purpose of the schedule transferred by this profile
+ *
+ * @param chargingProfilePurpose The purpose of the schedule transferred by this profile
+ * @return this
+ */
+ public ChargingProfileCriterion withChargingProfilePurpose(
+ @Nullable ChargingProfilePurposeEnum chargingProfilePurpose) {
+ setChargingProfilePurpose(chargingProfilePurpose);
+ return this;
+ }
+
+ /**
+ * Gets value determining level in hierarchy stack of profiles. Higher values have precedence over
+ * lower values. Lowest level is 0.
+ *
+ * @return Value determining level in hierarchy stack of profiles
+ */
+ @Nullable
+ public Integer getStackLevel() {
+ return stackLevel;
+ }
+
+ /**
+ * Sets value determining level in hierarchy stack of profiles. Higher values have precedence over
+ * lower values. Lowest level is 0.
+ *
+ * @param stackLevel Value determining level in hierarchy stack of profiles
+ */
+ public void setStackLevel(@Nullable Integer stackLevel) {
+ this.stackLevel = stackLevel;
+ }
+
+ /**
+ * Adds value determining level in hierarchy stack of profiles. Higher values have precedence over
+ * lower values. Lowest level is 0.
+ *
+ * @param stackLevel Value determining level in hierarchy stack of profiles
+ * @return this
+ */
+ public ChargingProfileCriterion withStackLevel(@Nullable Integer stackLevel) {
+ setStackLevel(stackLevel);
+ return this;
+ }
+
+ /**
+ * Gets list of all the chargingProfileIds requested. Any ChargingProfile that matches one of
+ * these profiles will be reported. If omitted, the Charging Station SHALL not filter on
+ * chargingProfileId. This field SHALL NOT contain more ids than set in
+ * ChargingProfileEntries.maxLimit
+ *
+ * @return List of all the chargingProfileIds requested
+ */
+ @Nullable
+ public Integer[] getChargingProfileId() {
+ return chargingProfileId;
+ }
+
+ /**
+ * Sets list of all the chargingProfileIds requested. Any ChargingProfile that matches one of
+ * these profiles will be reported. If omitted, the Charging Station SHALL not filter on
+ * chargingProfileId. This field SHALL NOT contain more ids than set in
+ * ChargingProfileEntries.maxLimit
+ *
+ * @param chargingProfileId List of all the chargingProfileIds requested
+ */
+ public void setChargingProfileId(@Nullable Integer[] chargingProfileId) {
+ if (!isValidChargingProfileId(chargingProfileId)) {
+ throw new PropertyConstraintException(chargingProfileId, "chargingProfileId is invalid");
+ }
+ this.chargingProfileId = chargingProfileId;
+ }
+
+ /**
+ * Returns whether the given chargingProfileId is valid
+ *
+ * @param chargingProfileId the chargingProfileId to check the validity of
+ * @return {@code true} if chargingProfileId is valid, {@code false} if not
+ */
+ private boolean isValidChargingProfileId(@Nullable Integer[] chargingProfileId) {
+ return chargingProfileId == null || (chargingProfileId.length >= 1);
+ }
+
+ /**
+ * Adds list of all the chargingProfileIds requested. Any ChargingProfile that matches one of
+ * these profiles will be reported. If omitted, the Charging Station SHALL not filter on
+ * chargingProfileId. This field SHALL NOT contain more ids than set in
+ * ChargingProfileEntries.maxLimit
+ *
+ * @param chargingProfileId List of all the chargingProfileIds requested
+ * @return this
+ */
+ public ChargingProfileCriterion withChargingProfileId(@Nullable Integer[] chargingProfileId) {
+ setChargingProfileId(chargingProfileId);
+ return this;
+ }
+
+ /**
+ * Gets for which charging limit sources, charging profiles SHALL be reported. If omitted, the
+ * Charging Station SHALL not filter on chargingLimitSource.
+ *
+ * @return For which charging limit sources, charging profiles SHALL be reported
+ */
+ @Nullable
+ public ChargingLimitSourceEnum[] getChargingLimitSource() {
+ return chargingLimitSource;
+ }
+
+ /**
+ * Sets for which charging limit sources, charging profiles SHALL be reported. If omitted, the
+ * Charging Station SHALL not filter on chargingLimitSource.
+ *
+ * @param chargingLimitSource For which charging limit sources, charging profiles SHALL be
+ * reported
+ */
+ public void setChargingLimitSource(@Nullable ChargingLimitSourceEnum[] chargingLimitSource) {
+ if (!isValidChargingLimitSource(chargingLimitSource)) {
+ throw new PropertyConstraintException(chargingLimitSource, "chargingLimitSource is invalid");
+ }
+ this.chargingLimitSource = chargingLimitSource;
+ }
+
+ /**
+ * Returns whether the given chargingLimitSource is valid
+ *
+ * @param chargingLimitSource the chargingLimitSource to check the validity of
+ * @return {@code true} if chargingLimitSource is valid, {@code false} if not
+ */
+ private boolean isValidChargingLimitSource(
+ @Nullable ChargingLimitSourceEnum[] chargingLimitSource) {
+ return chargingLimitSource == null
+ || (chargingLimitSource.length >= 1 && chargingLimitSource.length <= 4);
+ }
+
+ /**
+ * Adds for which charging limit sources, charging profiles SHALL be reported. If omitted, the
+ * Charging Station SHALL not filter on chargingLimitSource.
+ *
+ * @param chargingLimitSource For which charging limit sources, charging profiles SHALL be
+ * reported
+ * @return this
+ */
+ public ChargingProfileCriterion withChargingLimitSource(
+ @Nullable ChargingLimitSourceEnum[] chargingLimitSource) {
+ setChargingLimitSource(chargingLimitSource);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidChargingProfileId(chargingProfileId)
+ && isValidChargingLimitSource(chargingLimitSource);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ChargingProfileCriterion that = (ChargingProfileCriterion) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(chargingProfilePurpose, that.chargingProfilePurpose)
+ && Objects.equals(stackLevel, that.stackLevel)
+ && Arrays.equals(chargingProfileId, that.chargingProfileId)
+ && Arrays.equals(chargingLimitSource, that.chargingLimitSource);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ chargingProfilePurpose,
+ stackLevel,
+ Arrays.hashCode(chargingProfileId),
+ Arrays.hashCode(chargingLimitSource));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("chargingProfilePurpose", chargingProfilePurpose)
+ .add("stackLevel", stackLevel)
+ .add("chargingProfileId", chargingProfileId)
+ .add("chargingLimitSource", chargingLimitSource)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfileKindEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfileKindEnum.java
new file mode 100644
index 000000000..cd1bc44af
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfileKindEnum.java
@@ -0,0 +1,36 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Charging Profile. Charging Profile Kind. Charging Profile Kind Code
+ *
+ * The kind of schedule.
+ */
+public enum ChargingProfileKindEnum {
+ Absolute,
+ Recurring,
+ Relative
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfilePurposeEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfilePurposeEnum.java
new file mode 100644
index 000000000..62942ec88
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfilePurposeEnum.java
@@ -0,0 +1,37 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Charging Profile. Charging Profile Purpose. Charging Profile Purpose Code
+ *
+ * The purpose of the schedule transferred by this profile
+ */
+public enum ChargingProfilePurposeEnum {
+ ChargingStationExternalConstraints,
+ ChargingStationMaxProfile,
+ TxDefaultProfile,
+ TxProfile
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfileStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfileStatusEnum.java
new file mode 100644
index 000000000..19775ec89
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingProfileStatusEnum.java
@@ -0,0 +1,35 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Returns whether the Charging Station has been able to process the message successfully. This does
+ * not guarantee the schedule will be followed to the letter. There might be other constraints the
+ * Charging Station may need to take into account.
+ */
+public enum ChargingProfileStatusEnum {
+ Accepted,
+ Rejected
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingRateUnitEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingRateUnitEnum.java
new file mode 100644
index 000000000..7ae9885b4
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingRateUnitEnum.java
@@ -0,0 +1,35 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Charging Schedule. Charging Rate Unit. Charging Rate Unit Code
+ *
+ * The unit of measure Limit is expressed in.
+ */
+public enum ChargingRateUnitEnum {
+ W,
+ A
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingSchedule.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingSchedule.java
new file mode 100644
index 000000000..49a04c63f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingSchedule.java
@@ -0,0 +1,458 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.time.ZonedDateTime;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Charging Schedule
+ *
+ * Charging schedule structure defines a list of charging periods, as used in:
+ * GetCompositeSchedule.conf and ChargingProfile.
+ */
+public final class ChargingSchedule {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The identifier of the ChargingSchedule. */
+ private Integer id;
+
+ /**
+ * Charging Schedule. Start Schedule. Date Time
+ *
+ * Starting point of an absolute schedule. If absent the schedule will be relative to start of
+ * charging.
+ */
+ @Nullable private ZonedDateTime startSchedule;
+
+ /**
+ * Charging Schedule. Duration. Elapsed Time
+ *
+ * Duration of the charging schedule in seconds. If the duration is left empty, the last period
+ * will continue indefinitely or until end of the transaction if chargingProfilePurpose =
+ * TxProfile.
+ */
+ @Nullable private Integer duration;
+
+ /**
+ * Charging Schedule. Charging Rate Unit. Charging Rate Unit Code
+ *
+ * The unit of measure Limit is expressed in.
+ */
+ private ChargingRateUnitEnum chargingRateUnit;
+
+ /**
+ * Charging Schedule Period
+ *
+ * Charging schedule period structure defines a time period in a charging schedule.
+ */
+ private ChargingSchedulePeriod[] chargingSchedulePeriod;
+
+ /**
+ * Charging Schedule. Min Charging Rate. Numeric
+ *
+ * Minimum charging rate supported by the EV. The unit of measure is defined by the
+ * chargingRateUnit. This parameter is intended to be used by a local smart charging algorithm to
+ * optimize the power allocation for in the case a charging process is inefficient at lower
+ * charging rates. Accepts at most one digit fraction (e.g. 8.1)
+ */
+ @Nullable private Double minChargingRate;
+
+ /**
+ * Sales Tariff
+ *
+ * NOTE: This dataType is based on dataTypes from ISO 15118-2.
+ */
+ @Nullable private SalesTariff salesTariff;
+
+ /**
+ * Constructor for the ChargingSchedule class
+ *
+ * @param id The identifier of the ChargingSchedule.
+ * @param chargingRateUnit The unit of measure Limit is expressed in.
+ * @param chargingSchedulePeriod Charging schedule period structure defines a time period in a
+ * charging schedule.
+ */
+ public ChargingSchedule(
+ Integer id,
+ ChargingRateUnitEnum chargingRateUnit,
+ ChargingSchedulePeriod[] chargingSchedulePeriod) {
+ setId(id);
+ setChargingRateUnit(chargingRateUnit);
+ setChargingSchedulePeriod(chargingSchedulePeriod);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ChargingSchedule withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the identifier of the ChargingSchedule.
+ *
+ * @return The identifier of the ChargingSchedule
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * Sets the identifier of the ChargingSchedule.
+ *
+ * @param id The identifier of the ChargingSchedule
+ */
+ public void setId(Integer id) {
+ if (!isValidId(id)) {
+ throw new PropertyConstraintException(id, "id is invalid");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Returns whether the given id is valid
+ *
+ * @param id the id to check the validity of
+ * @return {@code true} if id is valid, {@code false} if not
+ */
+ private boolean isValidId(Integer id) {
+ return id != null;
+ }
+
+ /**
+ * Gets starting point of an absolute schedule. If absent the schedule will be relative to start
+ * of charging.
+ *
+ * @return Starting point of an absolute schedule
+ */
+ @Nullable
+ public ZonedDateTime getStartSchedule() {
+ return startSchedule;
+ }
+
+ /**
+ * Sets starting point of an absolute schedule. If absent the schedule will be relative to start
+ * of charging.
+ *
+ * @param startSchedule Starting point of an absolute schedule
+ */
+ public void setStartSchedule(@Nullable ZonedDateTime startSchedule) {
+ this.startSchedule = startSchedule;
+ }
+
+ /**
+ * Adds starting point of an absolute schedule. If absent the schedule will be relative to start
+ * of charging.
+ *
+ * @param startSchedule Starting point of an absolute schedule
+ * @return this
+ */
+ public ChargingSchedule withStartSchedule(@Nullable ZonedDateTime startSchedule) {
+ setStartSchedule(startSchedule);
+ return this;
+ }
+
+ /**
+ * Gets duration of the charging schedule in seconds. If the duration is left empty, the last
+ * period will continue indefinitely or until end of the transaction if chargingProfilePurpose =
+ * TxProfile.
+ *
+ * @return Duration of the charging schedule in seconds
+ */
+ @Nullable
+ public Integer getDuration() {
+ return duration;
+ }
+
+ /**
+ * Sets duration of the charging schedule in seconds. If the duration is left empty, the last
+ * period will continue indefinitely or until end of the transaction if chargingProfilePurpose =
+ * TxProfile.
+ *
+ * @param duration Duration of the charging schedule in seconds
+ */
+ public void setDuration(@Nullable Integer duration) {
+ this.duration = duration;
+ }
+
+ /**
+ * Adds duration of the charging schedule in seconds. If the duration is left empty, the last
+ * period will continue indefinitely or until end of the transaction if chargingProfilePurpose =
+ * TxProfile.
+ *
+ * @param duration Duration of the charging schedule in seconds
+ * @return this
+ */
+ public ChargingSchedule withDuration(@Nullable Integer duration) {
+ setDuration(duration);
+ return this;
+ }
+
+ /**
+ * Gets the unit of measure Limit is expressed in.
+ *
+ * @return The unit of measure Limit is expressed in
+ */
+ public ChargingRateUnitEnum getChargingRateUnit() {
+ return chargingRateUnit;
+ }
+
+ /**
+ * Sets the unit of measure Limit is expressed in.
+ *
+ * @param chargingRateUnit The unit of measure Limit is expressed in
+ */
+ public void setChargingRateUnit(ChargingRateUnitEnum chargingRateUnit) {
+ if (!isValidChargingRateUnit(chargingRateUnit)) {
+ throw new PropertyConstraintException(chargingRateUnit, "chargingRateUnit is invalid");
+ }
+ this.chargingRateUnit = chargingRateUnit;
+ }
+
+ /**
+ * Returns whether the given chargingRateUnit is valid
+ *
+ * @param chargingRateUnit the chargingRateUnit to check the validity of
+ * @return {@code true} if chargingRateUnit is valid, {@code false} if not
+ */
+ private boolean isValidChargingRateUnit(ChargingRateUnitEnum chargingRateUnit) {
+ return chargingRateUnit != null;
+ }
+
+ /**
+ * Gets charging schedule period structure defines a time period in a charging schedule.
+ *
+ * @return Charging schedule period structure defines a time period in a charging schedule
+ */
+ public ChargingSchedulePeriod[] getChargingSchedulePeriod() {
+ return chargingSchedulePeriod;
+ }
+
+ /**
+ * Sets charging schedule period structure defines a time period in a charging schedule.
+ *
+ * @param chargingSchedulePeriod Charging schedule period structure defines a time period in a
+ * charging schedule
+ */
+ public void setChargingSchedulePeriod(ChargingSchedulePeriod[] chargingSchedulePeriod) {
+ if (!isValidChargingSchedulePeriod(chargingSchedulePeriod)) {
+ throw new PropertyConstraintException(
+ chargingSchedulePeriod, "chargingSchedulePeriod is invalid");
+ }
+ this.chargingSchedulePeriod = chargingSchedulePeriod;
+ }
+
+ /**
+ * Returns whether the given chargingSchedulePeriod is valid
+ *
+ * @param chargingSchedulePeriod the chargingSchedulePeriod to check the validity of
+ * @return {@code true} if chargingSchedulePeriod is valid, {@code false} if not
+ */
+ private boolean isValidChargingSchedulePeriod(ChargingSchedulePeriod[] chargingSchedulePeriod) {
+ return chargingSchedulePeriod != null
+ && chargingSchedulePeriod.length >= 1
+ && chargingSchedulePeriod.length <= 1024
+ && Arrays.stream(chargingSchedulePeriod).allMatch(item -> item.validate());
+ }
+
+ /**
+ * Gets minimum charging rate supported by the EV. The unit of measure is defined by the
+ * chargingRateUnit. This parameter is intended to be used by a local smart charging algorithm to
+ * optimize the power allocation for in the case a charging process is inefficient at lower
+ * charging rates. Accepts at most one digit fraction (e.g. 8.1)
+ *
+ * @return Minimum charging rate supported by the EV
+ */
+ @Nullable
+ public Double getMinChargingRate() {
+ return minChargingRate;
+ }
+
+ /**
+ * Sets minimum charging rate supported by the EV. The unit of measure is defined by the
+ * chargingRateUnit. This parameter is intended to be used by a local smart charging algorithm to
+ * optimize the power allocation for in the case a charging process is inefficient at lower
+ * charging rates. Accepts at most one digit fraction (e.g. 8.1)
+ *
+ * @param minChargingRate Minimum charging rate supported by the EV
+ */
+ public void setMinChargingRate(@Nullable Double minChargingRate) {
+ this.minChargingRate = minChargingRate;
+ }
+
+ /**
+ * Adds minimum charging rate supported by the EV. The unit of measure is defined by the
+ * chargingRateUnit. This parameter is intended to be used by a local smart charging algorithm to
+ * optimize the power allocation for in the case a charging process is inefficient at lower
+ * charging rates. Accepts at most one digit fraction (e.g. 8.1)
+ *
+ * @param minChargingRate Minimum charging rate supported by the EV
+ * @return this
+ */
+ public ChargingSchedule withMinChargingRate(@Nullable Double minChargingRate) {
+ setMinChargingRate(minChargingRate);
+ return this;
+ }
+
+ /**
+ * Gets NOTE: This dataType is based on dataTypes from ISO 15118-2.
+ *
+ * @return NOTE: This dataType is based on dataTypes from ISO 15118-2
+ */
+ @Nullable
+ public SalesTariff getSalesTariff() {
+ return salesTariff;
+ }
+
+ /**
+ * Sets NOTE: This dataType is based on dataTypes from ISO 15118-2.
+ *
+ * @param salesTariff NOTE: This dataType is based on dataTypes from ISO 15118-2
+ */
+ public void setSalesTariff(@Nullable SalesTariff salesTariff) {
+ if (!isValidSalesTariff(salesTariff)) {
+ throw new PropertyConstraintException(salesTariff, "salesTariff is invalid");
+ }
+ this.salesTariff = salesTariff;
+ }
+
+ /**
+ * Returns whether the given salesTariff is valid
+ *
+ * @param salesTariff the salesTariff to check the validity of
+ * @return {@code true} if salesTariff is valid, {@code false} if not
+ */
+ private boolean isValidSalesTariff(@Nullable SalesTariff salesTariff) {
+ return salesTariff == null || salesTariff.validate();
+ }
+
+ /**
+ * Adds NOTE: This dataType is based on dataTypes from ISO 15118-2.
+ *
+ * @param salesTariff NOTE: This dataType is based on dataTypes from ISO 15118-2
+ * @return this
+ */
+ public ChargingSchedule withSalesTariff(@Nullable SalesTariff salesTariff) {
+ setSalesTariff(salesTariff);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidId(id)
+ && isValidChargingRateUnit(chargingRateUnit)
+ && isValidChargingSchedulePeriod(chargingSchedulePeriod)
+ && isValidSalesTariff(salesTariff);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ChargingSchedule that = (ChargingSchedule) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(id, that.id)
+ && Objects.equals(startSchedule, that.startSchedule)
+ && Objects.equals(duration, that.duration)
+ && Objects.equals(chargingRateUnit, that.chargingRateUnit)
+ && Arrays.equals(chargingSchedulePeriod, that.chargingSchedulePeriod)
+ && Objects.equals(minChargingRate, that.minChargingRate)
+ && Objects.equals(salesTariff, that.salesTariff);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ id,
+ startSchedule,
+ duration,
+ chargingRateUnit,
+ Arrays.hashCode(chargingSchedulePeriod),
+ minChargingRate,
+ salesTariff);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("id", id)
+ .add("startSchedule", startSchedule)
+ .add("duration", duration)
+ .add("chargingRateUnit", chargingRateUnit)
+ .add("chargingSchedulePeriod", chargingSchedulePeriod)
+ .add("minChargingRate", minChargingRate)
+ .add("salesTariff", salesTariff)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingSchedulePeriod.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingSchedulePeriod.java
new file mode 100644
index 000000000..4cafac04b
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingSchedulePeriod.java
@@ -0,0 +1,309 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Charging Schedule Period
+ *
+ * Charging schedule period structure defines a time period in a charging schedule.
+ */
+public final class ChargingSchedulePeriod {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Charging Schedule Period. Start Period. Elapsed Time
+ *
+ * Start of the period, in seconds from the start of schedule. The value of StartPeriod also
+ * defines the stop time of the previous period.
+ */
+ private Integer startPeriod;
+
+ /**
+ * Charging Schedule Period. Limit. Measure
+ *
+ * Charging rate limit during the schedule period, in the applicable chargingRateUnit, for
+ * example in Amperes (A) or Watts (W). Accepts at most one digit fraction (e.g. 8.1).
+ */
+ private Double limit;
+
+ /**
+ * Charging Schedule Period. Number Phases. Counter
+ *
+ * The number of phases that can be used for charging. If a number of phases is needed,
+ * numberPhases=3 will be assumed unless another number is given.
+ */
+ @Nullable private Integer numberPhases;
+
+ /**
+ * Values: 1..3, Used if numberPhases=1 and if the EVSE is capable of switching the phase
+ * connected to the EV, i.e. ACPhaseSwitchingSupported is defined and true. Itâs not allowed
+ * unless both conditions above are true. If both conditions are true, and phaseToUse is omitted,
+ * the Charging Station / EVSE will make the selection on its own.
+ */
+ @Nullable private Integer phaseToUse;
+
+ /**
+ * Constructor for the ChargingSchedulePeriod class
+ *
+ * @param startPeriod Start of the period, in seconds from the start of schedule. The value of
+ * StartPeriod also defines the stop time of the previous period.
+ * @param limit Charging rate limit during the schedule period, in the applicable
+ * chargingRateUnit, for example in Amperes (A) or Watts (W). Accepts at most one digit
+ * fraction (e.g. 8.1).
+ */
+ public ChargingSchedulePeriod(Integer startPeriod, Double limit) {
+ setStartPeriod(startPeriod);
+ setLimit(limit);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ChargingSchedulePeriod withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets start of the period, in seconds from the start of schedule. The value of StartPeriod also
+ * defines the stop time of the previous period.
+ *
+ * @return Start of the period, in seconds from the start of schedule
+ */
+ public Integer getStartPeriod() {
+ return startPeriod;
+ }
+
+ /**
+ * Sets start of the period, in seconds from the start of schedule. The value of StartPeriod also
+ * defines the stop time of the previous period.
+ *
+ * @param startPeriod Start of the period, in seconds from the start of schedule
+ */
+ public void setStartPeriod(Integer startPeriod) {
+ if (!isValidStartPeriod(startPeriod)) {
+ throw new PropertyConstraintException(startPeriod, "startPeriod is invalid");
+ }
+ this.startPeriod = startPeriod;
+ }
+
+ /**
+ * Returns whether the given startPeriod is valid
+ *
+ * @param startPeriod the startPeriod to check the validity of
+ * @return {@code true} if startPeriod is valid, {@code false} if not
+ */
+ private boolean isValidStartPeriod(Integer startPeriod) {
+ return startPeriod != null;
+ }
+
+ /**
+ * Gets charging rate limit during the schedule period, in the applicable chargingRateUnit, for
+ * example in Amperes (A) or Watts (W). Accepts at most one digit fraction (e.g. 8.1).
+ *
+ * @return Charging rate limit during the schedule period, in the applicable chargingRateUnit, for
+ * example in Amperes (A) or Watts (W)
+ */
+ public Double getLimit() {
+ return limit;
+ }
+
+ /**
+ * Sets charging rate limit during the schedule period, in the applicable chargingRateUnit, for
+ * example in Amperes (A) or Watts (W). Accepts at most one digit fraction (e.g. 8.1).
+ *
+ * @param limit Charging rate limit during the schedule period, in the applicable
+ * chargingRateUnit, for example in Amperes (A) or Watts (W)
+ */
+ public void setLimit(Double limit) {
+ if (!isValidLimit(limit)) {
+ throw new PropertyConstraintException(limit, "limit is invalid");
+ }
+ this.limit = limit;
+ }
+
+ /**
+ * Returns whether the given limit is valid
+ *
+ * @param limit the limit to check the validity of
+ * @return {@code true} if limit is valid, {@code false} if not
+ */
+ private boolean isValidLimit(Double limit) {
+ return limit != null;
+ }
+
+ /**
+ * Gets the number of phases that can be used for charging. If a number of phases is needed,
+ * numberPhases=3 will be assumed unless another number is given.
+ *
+ * @return The number of phases that can be used for charging
+ */
+ @Nullable
+ public Integer getNumberPhases() {
+ return numberPhases;
+ }
+
+ /**
+ * Sets the number of phases that can be used for charging. If a number of phases is needed,
+ * numberPhases=3 will be assumed unless another number is given.
+ *
+ * @param numberPhases The number of phases that can be used for charging
+ */
+ public void setNumberPhases(@Nullable Integer numberPhases) {
+ this.numberPhases = numberPhases;
+ }
+
+ /**
+ * Adds the number of phases that can be used for charging. If a number of phases is needed,
+ * numberPhases=3 will be assumed unless another number is given.
+ *
+ * @param numberPhases The number of phases that can be used for charging
+ * @return this
+ */
+ public ChargingSchedulePeriod withNumberPhases(@Nullable Integer numberPhases) {
+ setNumberPhases(numberPhases);
+ return this;
+ }
+
+ /**
+ * Gets values: 1..3, Used if numberPhases=1 and if the EVSE is capable of switching the phase
+ * connected to the EV, i.e. ACPhaseSwitchingSupported is defined and true. Itâs not allowed
+ * unless both conditions above are true. If both conditions are true, and phaseToUse is omitted,
+ * the Charging Station / EVSE will make the selection on its own.
+ *
+ * @return Values: 1..3, Used if numberPhases=1 and if the EVSE is capable of switching the phase
+ * connected to the EV, i.e. ACPhaseSwitchingSupported is defined and true
+ */
+ @Nullable
+ public Integer getPhaseToUse() {
+ return phaseToUse;
+ }
+
+ /**
+ * Sets values: 1..3, Used if numberPhases=1 and if the EVSE is capable of switching the phase
+ * connected to the EV, i.e. ACPhaseSwitchingSupported is defined and true. Itâs not allowed
+ * unless both conditions above are true. If both conditions are true, and phaseToUse is omitted,
+ * the Charging Station / EVSE will make the selection on its own.
+ *
+ * @param phaseToUse Values: 1..3, Used if numberPhases=1 and if the EVSE is capable of switching
+ * the phase connected to the EV, i.e. ACPhaseSwitchingSupported is defined and true
+ */
+ public void setPhaseToUse(@Nullable Integer phaseToUse) {
+ this.phaseToUse = phaseToUse;
+ }
+
+ /**
+ * Adds values: 1..3, Used if numberPhases=1 and if the EVSE is capable of switching the phase
+ * connected to the EV, i.e. ACPhaseSwitchingSupported is defined and true. Itâs not allowed
+ * unless both conditions above are true. If both conditions are true, and phaseToUse is omitted,
+ * the Charging Station / EVSE will make the selection on its own.
+ *
+ * @param phaseToUse Values: 1..3, Used if numberPhases=1 and if the EVSE is capable of switching
+ * the phase connected to the EV, i.e. ACPhaseSwitchingSupported is defined and true
+ * @return this
+ */
+ public ChargingSchedulePeriod withPhaseToUse(@Nullable Integer phaseToUse) {
+ setPhaseToUse(phaseToUse);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStartPeriod(startPeriod) && isValidLimit(limit);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ChargingSchedulePeriod that = (ChargingSchedulePeriod) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(startPeriod, that.startPeriod)
+ && Objects.equals(limit, that.limit)
+ && Objects.equals(numberPhases, that.numberPhases)
+ && Objects.equals(phaseToUse, that.phaseToUse);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, startPeriod, limit, numberPhases, phaseToUse);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("startPeriod", startPeriod)
+ .add("limit", limit)
+ .add("numberPhases", numberPhases)
+ .add("phaseToUse", phaseToUse)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingStateEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingStateEnum.java
new file mode 100644
index 000000000..1ab1aa79e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingStateEnum.java
@@ -0,0 +1,38 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Transaction. State. Transaction State Code
+ *
+ * Current charging state, is required when state has changed.
+ */
+public enum ChargingStateEnum {
+ Charging,
+ EVConnected,
+ SuspendedEV,
+ SuspendedEVSE,
+ Idle
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingStation.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingStation.java
new file mode 100644
index 000000000..35af9b62f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingStation.java
@@ -0,0 +1,363 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Charge Point
+ *
+ * The physical system where an Electrical Vehicle (EV) can be charged.
+ */
+public final class ChargingStation {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Device. Serial Number. Serial Number
+ *
+ * Vendor-specific device identifier.
+ */
+ @Nullable private String serialNumber;
+
+ /**
+ * Device. Model. CI20 Text
+ *
+ * The model of the device.
+ */
+ private String model;
+
+ /**
+ * Wireless Communication Module
+ *
+ * Parameters required for initiating and maintaining wireless communication with other
+ * devices.
+ */
+ @Nullable private Modem modem;
+
+ /** The identifier of the vendor (not necessarily in a unique manner). */
+ private String vendorName;
+
+ /** The firmware version of the Charging Station. */
+ @Nullable private String firmwareVersion;
+
+ /**
+ * Constructor for the ChargingStation class
+ *
+ * @param model The model of the device.
+ * @param vendorName The identifier of the vendor (not necessarily in a unique manner).
+ */
+ public ChargingStation(String model, String vendorName) {
+ setModel(model);
+ setVendorName(vendorName);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ChargingStation withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets vendor-specific device identifier.
+ *
+ * @return Vendor-specific device identifier
+ */
+ @Nullable
+ public String getSerialNumber() {
+ return serialNumber;
+ }
+
+ /**
+ * Sets vendor-specific device identifier.
+ *
+ * @param serialNumber Vendor-specific device identifier
+ */
+ public void setSerialNumber(@Nullable String serialNumber) {
+ if (!isValidSerialNumber(serialNumber)) {
+ throw new PropertyConstraintException(serialNumber, "serialNumber is invalid");
+ }
+ this.serialNumber = serialNumber;
+ }
+
+ /**
+ * Returns whether the given serialNumber is valid
+ *
+ * @param serialNumber the serialNumber to check the validity of
+ * @return {@code true} if serialNumber is valid, {@code false} if not
+ */
+ private boolean isValidSerialNumber(@Nullable String serialNumber) {
+ return serialNumber == null || serialNumber.length() <= 25;
+ }
+
+ /**
+ * Adds vendor-specific device identifier.
+ *
+ * @param serialNumber Vendor-specific device identifier
+ * @return this
+ */
+ public ChargingStation withSerialNumber(@Nullable String serialNumber) {
+ setSerialNumber(serialNumber);
+ return this;
+ }
+
+ /**
+ * Gets the model of the device.
+ *
+ * @return The model of the device
+ */
+ public String getModel() {
+ return model;
+ }
+
+ /**
+ * Sets the model of the device.
+ *
+ * @param model The model of the device
+ */
+ public void setModel(String model) {
+ if (!isValidModel(model)) {
+ throw new PropertyConstraintException(model, "model is invalid");
+ }
+ this.model = model;
+ }
+
+ /**
+ * Returns whether the given model is valid
+ *
+ * @param model the model to check the validity of
+ * @return {@code true} if model is valid, {@code false} if not
+ */
+ private boolean isValidModel(String model) {
+ return model != null && model.length() <= 20;
+ }
+
+ /**
+ * Gets parameters required for initiating and maintaining wireless communication with other
+ * devices.
+ *
+ * @return Parameters required for initiating and maintaining wireless communication with other
+ * devices
+ */
+ @Nullable
+ public Modem getModem() {
+ return modem;
+ }
+
+ /**
+ * Sets parameters required for initiating and maintaining wireless communication with other
+ * devices.
+ *
+ * @param modem Parameters required for initiating and maintaining wireless communication with
+ * other devices
+ */
+ public void setModem(@Nullable Modem modem) {
+ if (!isValidModem(modem)) {
+ throw new PropertyConstraintException(modem, "modem is invalid");
+ }
+ this.modem = modem;
+ }
+
+ /**
+ * Returns whether the given modem is valid
+ *
+ * @param modem the modem to check the validity of
+ * @return {@code true} if modem is valid, {@code false} if not
+ */
+ private boolean isValidModem(@Nullable Modem modem) {
+ return modem == null || modem.validate();
+ }
+
+ /**
+ * Adds parameters required for initiating and maintaining wireless communication with other
+ * devices.
+ *
+ * @param modem Parameters required for initiating and maintaining wireless communication with
+ * other devices
+ * @return this
+ */
+ public ChargingStation withModem(@Nullable Modem modem) {
+ setModem(modem);
+ return this;
+ }
+
+ /**
+ * Gets the identifier of the vendor (not necessarily in a unique manner).
+ *
+ * @return The identifier of the vendor (not necessarily in a unique manner)
+ */
+ public String getVendorName() {
+ return vendorName;
+ }
+
+ /**
+ * Sets the identifier of the vendor (not necessarily in a unique manner).
+ *
+ * @param vendorName The identifier of the vendor (not necessarily in a unique manner)
+ */
+ public void setVendorName(String vendorName) {
+ if (!isValidVendorName(vendorName)) {
+ throw new PropertyConstraintException(vendorName, "vendorName is invalid");
+ }
+ this.vendorName = vendorName;
+ }
+
+ /**
+ * Returns whether the given vendorName is valid
+ *
+ * @param vendorName the vendorName to check the validity of
+ * @return {@code true} if vendorName is valid, {@code false} if not
+ */
+ private boolean isValidVendorName(String vendorName) {
+ return vendorName != null && vendorName.length() <= 50;
+ }
+
+ /**
+ * Gets the firmware version of the Charging Station.
+ *
+ * @return The firmware version of the Charging Station
+ */
+ @Nullable
+ public String getFirmwareVersion() {
+ return firmwareVersion;
+ }
+
+ /**
+ * Sets the firmware version of the Charging Station.
+ *
+ * @param firmwareVersion The firmware version of the Charging Station
+ */
+ public void setFirmwareVersion(@Nullable String firmwareVersion) {
+ if (!isValidFirmwareVersion(firmwareVersion)) {
+ throw new PropertyConstraintException(firmwareVersion, "firmwareVersion is invalid");
+ }
+ this.firmwareVersion = firmwareVersion;
+ }
+
+ /**
+ * Returns whether the given firmwareVersion is valid
+ *
+ * @param firmwareVersion the firmwareVersion to check the validity of
+ * @return {@code true} if firmwareVersion is valid, {@code false} if not
+ */
+ private boolean isValidFirmwareVersion(@Nullable String firmwareVersion) {
+ return firmwareVersion == null || firmwareVersion.length() <= 50;
+ }
+
+ /**
+ * Adds the firmware version of the Charging Station.
+ *
+ * @param firmwareVersion The firmware version of the Charging Station
+ * @return this
+ */
+ public ChargingStation withFirmwareVersion(@Nullable String firmwareVersion) {
+ setFirmwareVersion(firmwareVersion);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidSerialNumber(serialNumber)
+ && isValidModel(model)
+ && isValidModem(modem)
+ && isValidVendorName(vendorName)
+ && isValidFirmwareVersion(firmwareVersion);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ChargingStation that = (ChargingStation) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(serialNumber, that.serialNumber)
+ && Objects.equals(model, that.model)
+ && Objects.equals(modem, that.modem)
+ && Objects.equals(vendorName, that.vendorName)
+ && Objects.equals(firmwareVersion, that.firmwareVersion);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, serialNumber, model, modem, vendorName, firmwareVersion);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("serialNumber", serialNumber)
+ .add("model", model)
+ .add("modem", modem)
+ .add("vendorName", vendorName)
+ .add("firmwareVersion", firmwareVersion)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearCacheStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearCacheStatusEnum.java
new file mode 100644
index 000000000..6bd03656e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearCacheStatusEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Accepted if the Charging Station has executed the request, otherwise rejected. */
+public enum ClearCacheStatusEnum {
+ Accepted,
+ Rejected
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearChargingProfile.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearChargingProfile.java
new file mode 100644
index 000000000..8a68c8d6e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearChargingProfile.java
@@ -0,0 +1,261 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Charging Profile
+ *
+ * A ChargingProfile consists of a ChargingSchedule, describing the amount of power or current
+ * that can be delivered per time interval.
+ */
+public final class ClearChargingProfile {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Identified Object. MRID. Numeric Identifier
+ *
+ * Specifies the id of the EVSE for which to clear charging profiles. An evseId of zero (0)
+ * specifies the charging profile for the overall Charging Station. Absence of this parameter
+ * means the clearing applies to all charging profiles that match the other criteria in the
+ * request.
+ */
+ @Nullable private Integer evseId;
+
+ /**
+ * Charging Profile. Charging Profile Purpose. Charging Profile Purpose Code
+ *
+ * Specifies to purpose of the charging profiles that will be cleared, if they meet the other
+ * criteria in the request.
+ */
+ @Nullable private ChargingProfilePurposeEnum chargingProfilePurpose;
+
+ /**
+ * Charging Profile. Stack Level. Counter
+ *
+ * Specifies the stackLevel for which charging profiles will be cleared, if they meet the other
+ * criteria in the request.
+ */
+ @Nullable private Integer stackLevel;
+
+ /** Constructor for the ClearChargingProfile class */
+ public ClearChargingProfile() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ClearChargingProfile withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets specifies the id of the EVSE for which to clear charging profiles. An evseId of zero (0)
+ * specifies the charging profile for the overall Charging Station. Absence of this parameter
+ * means the clearing applies to all charging profiles that match the other criteria in the
+ * request.
+ *
+ * @return Specifies the id of the EVSE for which to clear charging profiles
+ */
+ @Nullable
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets specifies the id of the EVSE for which to clear charging profiles. An evseId of zero (0)
+ * specifies the charging profile for the overall Charging Station. Absence of this parameter
+ * means the clearing applies to all charging profiles that match the other criteria in the
+ * request.
+ *
+ * @param evseId Specifies the id of the EVSE for which to clear charging profiles
+ */
+ public void setEvseId(@Nullable Integer evseId) {
+ this.evseId = evseId;
+ }
+
+ /**
+ * Adds specifies the id of the EVSE for which to clear charging profiles. An evseId of zero (0)
+ * specifies the charging profile for the overall Charging Station. Absence of this parameter
+ * means the clearing applies to all charging profiles that match the other criteria in the
+ * request.
+ *
+ * @param evseId Specifies the id of the EVSE for which to clear charging profiles
+ * @return this
+ */
+ public ClearChargingProfile withEvseId(@Nullable Integer evseId) {
+ setEvseId(evseId);
+ return this;
+ }
+
+ /**
+ * Gets specifies to purpose of the charging profiles that will be cleared, if they meet the other
+ * criteria in the request.
+ *
+ * @return Specifies to purpose of the charging profiles that will be cleared, if they meet the
+ * other criteria in the request
+ */
+ @Nullable
+ public ChargingProfilePurposeEnum getChargingProfilePurpose() {
+ return chargingProfilePurpose;
+ }
+
+ /**
+ * Sets specifies to purpose of the charging profiles that will be cleared, if they meet the other
+ * criteria in the request.
+ *
+ * @param chargingProfilePurpose Specifies to purpose of the charging profiles that will be
+ * cleared, if they meet the other criteria in the request
+ */
+ public void setChargingProfilePurpose(
+ @Nullable ChargingProfilePurposeEnum chargingProfilePurpose) {
+ this.chargingProfilePurpose = chargingProfilePurpose;
+ }
+
+ /**
+ * Adds specifies to purpose of the charging profiles that will be cleared, if they meet the other
+ * criteria in the request.
+ *
+ * @param chargingProfilePurpose Specifies to purpose of the charging profiles that will be
+ * cleared, if they meet the other criteria in the request
+ * @return this
+ */
+ public ClearChargingProfile withChargingProfilePurpose(
+ @Nullable ChargingProfilePurposeEnum chargingProfilePurpose) {
+ setChargingProfilePurpose(chargingProfilePurpose);
+ return this;
+ }
+
+ /**
+ * Gets specifies the stackLevel for which charging profiles will be cleared, if they meet the
+ * other criteria in the request.
+ *
+ * @return Specifies the stackLevel for which charging profiles will be cleared, if they meet the
+ * other criteria in the request
+ */
+ @Nullable
+ public Integer getStackLevel() {
+ return stackLevel;
+ }
+
+ /**
+ * Sets specifies the stackLevel for which charging profiles will be cleared, if they meet the
+ * other criteria in the request.
+ *
+ * @param stackLevel Specifies the stackLevel for which charging profiles will be cleared, if they
+ * meet the other criteria in the request
+ */
+ public void setStackLevel(@Nullable Integer stackLevel) {
+ this.stackLevel = stackLevel;
+ }
+
+ /**
+ * Adds specifies the stackLevel for which charging profiles will be cleared, if they meet the
+ * other criteria in the request.
+ *
+ * @param stackLevel Specifies the stackLevel for which charging profiles will be cleared, if they
+ * meet the other criteria in the request
+ * @return this
+ */
+ public ClearChargingProfile withStackLevel(@Nullable Integer stackLevel) {
+ setStackLevel(stackLevel);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ClearChargingProfile that = (ClearChargingProfile) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(evseId, that.evseId)
+ && Objects.equals(chargingProfilePurpose, that.chargingProfilePurpose)
+ && Objects.equals(stackLevel, that.stackLevel);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, evseId, chargingProfilePurpose, stackLevel);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("evseId", evseId)
+ .add("chargingProfilePurpose", chargingProfilePurpose)
+ .add("stackLevel", stackLevel)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearChargingProfileStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearChargingProfileStatusEnum.java
new file mode 100644
index 000000000..2ac6334a1
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearChargingProfileStatusEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether the Charging Station was able to execute the request. */
+public enum ClearChargingProfileStatusEnum {
+ Accepted,
+ Unknown
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearMessageStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearMessageStatusEnum.java
new file mode 100644
index 000000000..f8c7fc103
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearMessageStatusEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Returns whether the Charging Station has been able to remove the message. */
+public enum ClearMessageStatusEnum {
+ Accepted,
+ Unknown
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearMonitoringResult.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearMonitoringResult.java
new file mode 100644
index 000000000..ba7362232
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearMonitoringResult.java
@@ -0,0 +1,242 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** ClearMonitoringResultType */
+public final class ClearMonitoringResult {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Result of the clear request for this monitor, identified by its Id. */
+ private ClearMonitoringStatusEnum status;
+
+ /** Id of the monitor of which a clear was requested. */
+ private Integer id;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Constructor for the ClearMonitoringResult class
+ *
+ * @param status Result of the clear request for this monitor, identified by its Id.
+ * @param id Id of the monitor of which a clear was requested.
+ */
+ public ClearMonitoringResult(ClearMonitoringStatusEnum status, Integer id) {
+ setStatus(status);
+ setId(id);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ClearMonitoringResult withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets result of the clear request for this monitor, identified by its Id.
+ *
+ * @return Result of the clear request for this monitor, identified by its Id
+ */
+ public ClearMonitoringStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets result of the clear request for this monitor, identified by its Id.
+ *
+ * @param status Result of the clear request for this monitor, identified by its Id
+ */
+ public void setStatus(ClearMonitoringStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(ClearMonitoringStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets id of the monitor of which a clear was requested.
+ *
+ * @return Id of the monitor of which a clear was requested
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * Sets id of the monitor of which a clear was requested.
+ *
+ * @param id Id of the monitor of which a clear was requested
+ */
+ public void setId(Integer id) {
+ if (!isValidId(id)) {
+ throw new PropertyConstraintException(id, "id is invalid");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Returns whether the given id is valid
+ *
+ * @param id the id to check the validity of
+ * @return {@code true} if id is valid, {@code false} if not
+ */
+ private boolean isValidId(Integer id) {
+ return id != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public ClearMonitoringResult withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidStatus(status)
+ && isValidId(id)
+ && isValidStatusInfo(statusInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ClearMonitoringResult that = (ClearMonitoringResult) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(id, that.id)
+ && Objects.equals(statusInfo, that.statusInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, status, id, statusInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("id", id)
+ .add("statusInfo", statusInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearMonitoringStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearMonitoringStatusEnum.java
new file mode 100644
index 000000000..bf36f9011
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ClearMonitoringStatusEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Result of the clear request for this monitor, identified by its Id. */
+public enum ClearMonitoringStatusEnum {
+ Accepted,
+ Rejected,
+ NotFound
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Component.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Component.java
new file mode 100644
index 000000000..6e2cfa3b8
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Component.java
@@ -0,0 +1,268 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** A physical or logical component */
+public final class Component {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * EVSE
+ *
+ * Electric Vehicle Supply Equipment
+ */
+ @Nullable private EVSE evse;
+
+ /**
+ * Name of the component. Name should be taken from the list of standardized component names
+ * whenever possible. Case Insensitive. strongly advised to use Camel Case.
+ */
+ private String name;
+
+ /**
+ * Name of instance in case the component exists as multiple instances. Case Insensitive. strongly
+ * advised to use Camel Case.
+ */
+ @Nullable private String instance;
+
+ /**
+ * Constructor for the Component class
+ *
+ * @param name Name of the component. Name should be taken from the list of standardized component
+ * names whenever possible. Case Insensitive. strongly advised to use Camel Case.
+ */
+ public Component(String name) {
+ setName(name);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public Component withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets electric Vehicle Supply Equipment
+ *
+ * @return Electric Vehicle Supply Equipment
+ */
+ @Nullable
+ public EVSE getEvse() {
+ return evse;
+ }
+
+ /**
+ * Sets electric Vehicle Supply Equipment
+ *
+ * @param evse Electric Vehicle Supply Equipment
+ */
+ public void setEvse(@Nullable EVSE evse) {
+ if (!isValidEvse(evse)) {
+ throw new PropertyConstraintException(evse, "evse is invalid");
+ }
+ this.evse = evse;
+ }
+
+ /**
+ * Returns whether the given evse is valid
+ *
+ * @param evse the evse to check the validity of
+ * @return {@code true} if evse is valid, {@code false} if not
+ */
+ private boolean isValidEvse(@Nullable EVSE evse) {
+ return evse == null || evse.validate();
+ }
+
+ /**
+ * Adds electric Vehicle Supply Equipment
+ *
+ * @param evse Electric Vehicle Supply Equipment
+ * @return this
+ */
+ public Component withEvse(@Nullable EVSE evse) {
+ setEvse(evse);
+ return this;
+ }
+
+ /**
+ * Gets name of the component. Name should be taken from the list of standardized component names
+ * whenever possible. Case Insensitive. strongly advised to use Camel Case.
+ *
+ * @return Name of the component
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets name of the component. Name should be taken from the list of standardized component names
+ * whenever possible. Case Insensitive. strongly advised to use Camel Case.
+ *
+ * @param name Name of the component
+ */
+ public void setName(String name) {
+ if (!isValidName(name)) {
+ throw new PropertyConstraintException(name, "name is invalid");
+ }
+ this.name = name;
+ }
+
+ /**
+ * Returns whether the given name is valid
+ *
+ * @param name the name to check the validity of
+ * @return {@code true} if name is valid, {@code false} if not
+ */
+ private boolean isValidName(String name) {
+ return name != null && name.length() <= 50;
+ }
+
+ /**
+ * Gets name of instance in case the component exists as multiple instances. Case Insensitive.
+ * strongly advised to use Camel Case.
+ *
+ * @return Name of instance in case the component exists as multiple instances
+ */
+ @Nullable
+ public String getInstance() {
+ return instance;
+ }
+
+ /**
+ * Sets name of instance in case the component exists as multiple instances. Case Insensitive.
+ * strongly advised to use Camel Case.
+ *
+ * @param instance Name of instance in case the component exists as multiple instances
+ */
+ public void setInstance(@Nullable String instance) {
+ if (!isValidInstance(instance)) {
+ throw new PropertyConstraintException(instance, "instance is invalid");
+ }
+ this.instance = instance;
+ }
+
+ /**
+ * Returns whether the given instance is valid
+ *
+ * @param instance the instance to check the validity of
+ * @return {@code true} if instance is valid, {@code false} if not
+ */
+ private boolean isValidInstance(@Nullable String instance) {
+ return instance == null || instance.length() <= 50;
+ }
+
+ /**
+ * Adds name of instance in case the component exists as multiple instances. Case Insensitive.
+ * strongly advised to use Camel Case.
+ *
+ * @param instance Name of instance in case the component exists as multiple instances
+ * @return this
+ */
+ public Component withInstance(@Nullable String instance) {
+ setInstance(instance);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidEvse(evse)
+ && isValidName(name)
+ && isValidInstance(instance);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Component that = (Component) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(evse, that.evse)
+ && Objects.equals(name, that.name)
+ && Objects.equals(instance, that.instance);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, evse, name, instance);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("evse", evse)
+ .add("name", name)
+ .add("instance", instance)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ComponentCriterionEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ComponentCriterionEnum.java
new file mode 100644
index 000000000..acbcc9016
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ComponentCriterionEnum.java
@@ -0,0 +1,33 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** ComponentCriterionEnumType */
+public enum ComponentCriterionEnum {
+ Active,
+ Available,
+ Enabled,
+ Problem
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ComponentVariable.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ComponentVariable.java
new file mode 100644
index 000000000..191465536
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ComponentVariable.java
@@ -0,0 +1,203 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Class to report components, variables and variable attributes and characteristics. */
+public final class ComponentVariable {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** A physical or logical component */
+ private Component component;
+
+ /** Reference key to a component-variable. */
+ @Nullable private Variable variable;
+
+ /**
+ * Constructor for the ComponentVariable class
+ *
+ * @param component A physical or logical component
+ */
+ public ComponentVariable(Component component) {
+ setComponent(component);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ComponentVariable withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets a physical or logical component
+ *
+ * @return A physical or logical component
+ */
+ public Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets a physical or logical component
+ *
+ * @param component A physical or logical component
+ */
+ public void setComponent(Component component) {
+ if (!isValidComponent(component)) {
+ throw new PropertyConstraintException(component, "component is invalid");
+ }
+ this.component = component;
+ }
+
+ /**
+ * Returns whether the given component is valid
+ *
+ * @param component the component to check the validity of
+ * @return {@code true} if component is valid, {@code false} if not
+ */
+ private boolean isValidComponent(Component component) {
+ return component != null && component.validate();
+ }
+
+ /**
+ * Gets reference key to a component-variable.
+ *
+ * @return Reference key to a component-variable
+ */
+ @Nullable
+ public Variable getVariable() {
+ return variable;
+ }
+
+ /**
+ * Sets reference key to a component-variable.
+ *
+ * @param variable Reference key to a component-variable
+ */
+ public void setVariable(@Nullable Variable variable) {
+ if (!isValidVariable(variable)) {
+ throw new PropertyConstraintException(variable, "variable is invalid");
+ }
+ this.variable = variable;
+ }
+
+ /**
+ * Returns whether the given variable is valid
+ *
+ * @param variable the variable to check the validity of
+ * @return {@code true} if variable is valid, {@code false} if not
+ */
+ private boolean isValidVariable(@Nullable Variable variable) {
+ return variable == null || variable.validate();
+ }
+
+ /**
+ * Adds reference key to a component-variable.
+ *
+ * @param variable Reference key to a component-variable
+ * @return this
+ */
+ public ComponentVariable withVariable(@Nullable Variable variable) {
+ setVariable(variable);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidComponent(component)
+ && isValidVariable(variable);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ComponentVariable that = (ComponentVariable) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(component, that.component)
+ && Objects.equals(variable, that.variable);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, component, variable);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("component", component)
+ .add("variable", variable)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CompositeSchedule.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CompositeSchedule.java
new file mode 100644
index 000000000..74305075b
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CompositeSchedule.java
@@ -0,0 +1,346 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.time.ZonedDateTime;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Composite Schedule */
+public final class CompositeSchedule {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Charging Schedule Period
+ *
+ * Charging schedule period structure defines a time period in a charging schedule.
+ */
+ private ChargingSchedulePeriod[] chargingSchedulePeriod;
+
+ /**
+ * The ID of the EVSE for which the schedule is requested. When evseid=0, the Charging Station
+ * calculated the expected consumption for the grid connection.
+ */
+ private Integer evseId;
+
+ /** Duration of the schedule in seconds. */
+ private Integer duration;
+
+ /**
+ * Composite Schedule. Start. Date Time
+ *
+ * Date and time at which the schedule becomes active. All time measurements within the
+ * schedule are relative to this timestamp.
+ */
+ private ZonedDateTime scheduleStart;
+
+ /** The unit of measure Limit is expressed in. */
+ private ChargingRateUnitEnum chargingRateUnit;
+
+ /**
+ * Constructor for the CompositeSchedule class
+ *
+ * @param chargingSchedulePeriod Charging schedule period structure defines a time period in a
+ * charging schedule.
+ * @param evseId The ID of the EVSE for which the schedule is requested. When evseid=0, the
+ * Charging Station calculated the expected consumption for the grid connection.
+ * @param duration Duration of the schedule in seconds.
+ * @param scheduleStart Date and time at which the schedule becomes active. All time measurements
+ * within the schedule are relative to this timestamp.
+ * @param chargingRateUnit The unit of measure Limit is expressed in.
+ */
+ public CompositeSchedule(
+ ChargingSchedulePeriod[] chargingSchedulePeriod,
+ Integer evseId,
+ Integer duration,
+ ZonedDateTime scheduleStart,
+ ChargingRateUnitEnum chargingRateUnit) {
+ setChargingSchedulePeriod(chargingSchedulePeriod);
+ setEvseId(evseId);
+ setDuration(duration);
+ setScheduleStart(scheduleStart);
+ setChargingRateUnit(chargingRateUnit);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public CompositeSchedule withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets charging schedule period structure defines a time period in a charging schedule.
+ *
+ * @return Charging schedule period structure defines a time period in a charging schedule
+ */
+ public ChargingSchedulePeriod[] getChargingSchedulePeriod() {
+ return chargingSchedulePeriod;
+ }
+
+ /**
+ * Sets charging schedule period structure defines a time period in a charging schedule.
+ *
+ * @param chargingSchedulePeriod Charging schedule period structure defines a time period in a
+ * charging schedule
+ */
+ public void setChargingSchedulePeriod(ChargingSchedulePeriod[] chargingSchedulePeriod) {
+ if (!isValidChargingSchedulePeriod(chargingSchedulePeriod)) {
+ throw new PropertyConstraintException(
+ chargingSchedulePeriod, "chargingSchedulePeriod is invalid");
+ }
+ this.chargingSchedulePeriod = chargingSchedulePeriod;
+ }
+
+ /**
+ * Returns whether the given chargingSchedulePeriod is valid
+ *
+ * @param chargingSchedulePeriod the chargingSchedulePeriod to check the validity of
+ * @return {@code true} if chargingSchedulePeriod is valid, {@code false} if not
+ */
+ private boolean isValidChargingSchedulePeriod(ChargingSchedulePeriod[] chargingSchedulePeriod) {
+ return chargingSchedulePeriod != null
+ && chargingSchedulePeriod.length >= 1
+ && Arrays.stream(chargingSchedulePeriod).allMatch(item -> item.validate());
+ }
+
+ /**
+ * Gets the ID of the EVSE for which the schedule is requested. When evseid=0, the Charging
+ * Station calculated the expected consumption for the grid connection.
+ *
+ * @return The ID of the EVSE for which the schedule is requested
+ */
+ public Integer getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets the ID of the EVSE for which the schedule is requested. When evseid=0, the Charging
+ * Station calculated the expected consumption for the grid connection.
+ *
+ * @param evseId The ID of the EVSE for which the schedule is requested
+ */
+ public void setEvseId(Integer evseId) {
+ if (!isValidEvseId(evseId)) {
+ throw new PropertyConstraintException(evseId, "evseId is invalid");
+ }
+ this.evseId = evseId;
+ }
+
+ /**
+ * Returns whether the given evseId is valid
+ *
+ * @param evseId the evseId to check the validity of
+ * @return {@code true} if evseId is valid, {@code false} if not
+ */
+ private boolean isValidEvseId(Integer evseId) {
+ return evseId != null;
+ }
+
+ /**
+ * Gets duration of the schedule in seconds.
+ *
+ * @return Duration of the schedule in seconds
+ */
+ public Integer getDuration() {
+ return duration;
+ }
+
+ /**
+ * Sets duration of the schedule in seconds.
+ *
+ * @param duration Duration of the schedule in seconds
+ */
+ public void setDuration(Integer duration) {
+ if (!isValidDuration(duration)) {
+ throw new PropertyConstraintException(duration, "duration is invalid");
+ }
+ this.duration = duration;
+ }
+
+ /**
+ * Returns whether the given duration is valid
+ *
+ * @param duration the duration to check the validity of
+ * @return {@code true} if duration is valid, {@code false} if not
+ */
+ private boolean isValidDuration(Integer duration) {
+ return duration != null;
+ }
+
+ /**
+ * Gets date and time at which the schedule becomes active. All time measurements within the
+ * schedule are relative to this timestamp.
+ *
+ * @return Date and time at which the schedule becomes active
+ */
+ public ZonedDateTime getScheduleStart() {
+ return scheduleStart;
+ }
+
+ /**
+ * Sets date and time at which the schedule becomes active. All time measurements within the
+ * schedule are relative to this timestamp.
+ *
+ * @param scheduleStart Date and time at which the schedule becomes active
+ */
+ public void setScheduleStart(ZonedDateTime scheduleStart) {
+ if (!isValidScheduleStart(scheduleStart)) {
+ throw new PropertyConstraintException(scheduleStart, "scheduleStart is invalid");
+ }
+ this.scheduleStart = scheduleStart;
+ }
+
+ /**
+ * Returns whether the given scheduleStart is valid
+ *
+ * @param scheduleStart the scheduleStart to check the validity of
+ * @return {@code true} if scheduleStart is valid, {@code false} if not
+ */
+ private boolean isValidScheduleStart(ZonedDateTime scheduleStart) {
+ return scheduleStart != null;
+ }
+
+ /**
+ * Gets the unit of measure Limit is expressed in.
+ *
+ * @return The unit of measure Limit is expressed in
+ */
+ public ChargingRateUnitEnum getChargingRateUnit() {
+ return chargingRateUnit;
+ }
+
+ /**
+ * Sets the unit of measure Limit is expressed in.
+ *
+ * @param chargingRateUnit The unit of measure Limit is expressed in
+ */
+ public void setChargingRateUnit(ChargingRateUnitEnum chargingRateUnit) {
+ if (!isValidChargingRateUnit(chargingRateUnit)) {
+ throw new PropertyConstraintException(chargingRateUnit, "chargingRateUnit is invalid");
+ }
+ this.chargingRateUnit = chargingRateUnit;
+ }
+
+ /**
+ * Returns whether the given chargingRateUnit is valid
+ *
+ * @param chargingRateUnit the chargingRateUnit to check the validity of
+ * @return {@code true} if chargingRateUnit is valid, {@code false} if not
+ */
+ private boolean isValidChargingRateUnit(ChargingRateUnitEnum chargingRateUnit) {
+ return chargingRateUnit != null;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidChargingSchedulePeriod(chargingSchedulePeriod)
+ && isValidEvseId(evseId)
+ && isValidDuration(duration)
+ && isValidScheduleStart(scheduleStart)
+ && isValidChargingRateUnit(chargingRateUnit);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CompositeSchedule that = (CompositeSchedule) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(chargingSchedulePeriod, that.chargingSchedulePeriod)
+ && Objects.equals(evseId, that.evseId)
+ && Objects.equals(duration, that.duration)
+ && Objects.equals(scheduleStart, that.scheduleStart)
+ && Objects.equals(chargingRateUnit, that.chargingRateUnit);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ Arrays.hashCode(chargingSchedulePeriod),
+ evseId,
+ duration,
+ scheduleStart,
+ chargingRateUnit);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("chargingSchedulePeriod", chargingSchedulePeriod)
+ .add("evseId", evseId)
+ .add("duration", duration)
+ .add("scheduleStart", scheduleStart)
+ .add("chargingRateUnit", chargingRateUnit)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ConnectorEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ConnectorEnum.java
new file mode 100644
index 000000000..b89909f3d
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ConnectorEnum.java
@@ -0,0 +1,58 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import com.google.gson.annotations.SerializedName;
+
+/** The connector type. */
+public enum ConnectorEnum {
+ cCCS1,
+ cCCS2,
+ cG105,
+ cTesla,
+ cType1,
+ cType2,
+ @SerializedName("s309-1P-16A")
+ s309_1P_16A,
+ @SerializedName("s309-1P-32A")
+ s309_1P_32A,
+ @SerializedName("s309-3P-16A")
+ s309_3P_16A,
+ @SerializedName("s309-3P-32A")
+ s309_3P_32A,
+ sBS1361,
+ @SerializedName("sCEE-7-7")
+ sCEE_7_7,
+ sType2,
+ sType3,
+ Other1PhMax16A,
+ Other1PhOver16A,
+ Other3Ph,
+ Pan,
+ wInductive,
+ wResonant,
+ Undetermined,
+ Unknown
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ConnectorStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ConnectorStatusEnum.java
new file mode 100644
index 000000000..147e77fac
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ConnectorStatusEnum.java
@@ -0,0 +1,34 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The current status of the Connector. */
+public enum ConnectorStatusEnum {
+ Available,
+ Occupied,
+ Reserved,
+ Unavailable,
+ Faulted
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ConsumptionCost.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ConsumptionCost.java
new file mode 100644
index 000000000..800a26107
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ConsumptionCost.java
@@ -0,0 +1,205 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Consumption Cost */
+public final class ConsumptionCost {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Consumption Cost. Start Value. Numeric
+ *
+ * The lowest level of consumption that defines the starting point of this consumption block.
+ * The block interval extends to the start of the next interval.
+ */
+ private Double startValue;
+
+ /** Cost */
+ private Cost[] cost;
+
+ /**
+ * Constructor for the ConsumptionCost class
+ *
+ * @param startValue The lowest level of consumption that defines the starting point of this
+ * consumption block. The block interval extends to the start of the next interval.
+ * @param cost Cost
+ */
+ public ConsumptionCost(Double startValue, Cost[] cost) {
+ setStartValue(startValue);
+ setCost(cost);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ConsumptionCost withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the lowest level of consumption that defines the starting point of this consumption block.
+ * The block interval extends to the start of the next interval.
+ *
+ * @return The lowest level of consumption that defines the starting point of this consumption
+ * block
+ */
+ public Double getStartValue() {
+ return startValue;
+ }
+
+ /**
+ * Sets the lowest level of consumption that defines the starting point of this consumption block.
+ * The block interval extends to the start of the next interval.
+ *
+ * @param startValue The lowest level of consumption that defines the starting point of this
+ * consumption block
+ */
+ public void setStartValue(Double startValue) {
+ if (!isValidStartValue(startValue)) {
+ throw new PropertyConstraintException(startValue, "startValue is invalid");
+ }
+ this.startValue = startValue;
+ }
+
+ /**
+ * Returns whether the given startValue is valid
+ *
+ * @param startValue the startValue to check the validity of
+ * @return {@code true} if startValue is valid, {@code false} if not
+ */
+ private boolean isValidStartValue(Double startValue) {
+ return startValue != null;
+ }
+
+ /**
+ * Gets cost
+ *
+ * @return Cost
+ */
+ public Cost[] getCost() {
+ return cost;
+ }
+
+ /**
+ * Sets cost
+ *
+ * @param cost Cost
+ */
+ public void setCost(Cost[] cost) {
+ if (!isValidCost(cost)) {
+ throw new PropertyConstraintException(cost, "cost is invalid");
+ }
+ this.cost = cost;
+ }
+
+ /**
+ * Returns whether the given cost is valid
+ *
+ * @param cost the cost to check the validity of
+ * @return {@code true} if cost is valid, {@code false} if not
+ */
+ private boolean isValidCost(Cost[] cost) {
+ return cost != null
+ && cost.length >= 1
+ && cost.length <= 3
+ && Arrays.stream(cost).allMatch(item -> item.validate());
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStartValue(startValue) && isValidCost(cost);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ConsumptionCost that = (ConsumptionCost) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(startValue, that.startValue)
+ && Arrays.equals(cost, that.cost);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, startValue, Arrays.hashCode(cost));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("startValue", startValue)
+ .add("cost", cost)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Cost.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Cost.java
new file mode 100644
index 000000000..629459973
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Cost.java
@@ -0,0 +1,244 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Cost */
+public final class Cost {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Cost. Cost Kind. Cost Kind Code
+ *
+ * The kind of cost referred to in the message element amount
+ */
+ private CostKindEnum costKind;
+
+ /**
+ * Cost. Amount. Amount
+ *
+ * The estimated or actual cost per kWh
+ */
+ private Integer amount;
+
+ /**
+ * Cost. Amount Multiplier. Integer
+ *
+ * Values: -3..3, The amountMultiplier defines the exponent to base 10 (dec). The final value
+ * is determined by: amount * 10 ^ amountMultiplier
+ */
+ @Nullable private Integer amountMultiplier;
+
+ /**
+ * Constructor for the Cost class
+ *
+ * @param costKind The kind of cost referred to in the message element amount
+ * @param amount The estimated or actual cost per kWh
+ */
+ public Cost(CostKindEnum costKind, Integer amount) {
+ setCostKind(costKind);
+ setAmount(amount);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public Cost withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the kind of cost referred to in the message element amount
+ *
+ * @return The kind of cost referred to in the message element amount
+ */
+ public CostKindEnum getCostKind() {
+ return costKind;
+ }
+
+ /**
+ * Sets the kind of cost referred to in the message element amount
+ *
+ * @param costKind The kind of cost referred to in the message element amount
+ */
+ public void setCostKind(CostKindEnum costKind) {
+ if (!isValidCostKind(costKind)) {
+ throw new PropertyConstraintException(costKind, "costKind is invalid");
+ }
+ this.costKind = costKind;
+ }
+
+ /**
+ * Returns whether the given costKind is valid
+ *
+ * @param costKind the costKind to check the validity of
+ * @return {@code true} if costKind is valid, {@code false} if not
+ */
+ private boolean isValidCostKind(CostKindEnum costKind) {
+ return costKind != null;
+ }
+
+ /**
+ * Gets the estimated or actual cost per kWh
+ *
+ * @return The estimated or actual cost per kWh
+ */
+ public Integer getAmount() {
+ return amount;
+ }
+
+ /**
+ * Sets the estimated or actual cost per kWh
+ *
+ * @param amount The estimated or actual cost per kWh
+ */
+ public void setAmount(Integer amount) {
+ if (!isValidAmount(amount)) {
+ throw new PropertyConstraintException(amount, "amount is invalid");
+ }
+ this.amount = amount;
+ }
+
+ /**
+ * Returns whether the given amount is valid
+ *
+ * @param amount the amount to check the validity of
+ * @return {@code true} if amount is valid, {@code false} if not
+ */
+ private boolean isValidAmount(Integer amount) {
+ return amount != null;
+ }
+
+ /**
+ * Gets values: -3..3, The amountMultiplier defines the exponent to base 10 (dec). The final value
+ * is determined by: amount * 10 ^ amountMultiplier
+ *
+ * @return Values: -3..3, The amountMultiplier defines the exponent to base 10 (dec)
+ */
+ @Nullable
+ public Integer getAmountMultiplier() {
+ return amountMultiplier;
+ }
+
+ /**
+ * Sets values: -3..3, The amountMultiplier defines the exponent to base 10 (dec). The final value
+ * is determined by: amount * 10 ^ amountMultiplier
+ *
+ * @param amountMultiplier Values: -3..3, The amountMultiplier defines the exponent to base 10
+ * (dec)
+ */
+ public void setAmountMultiplier(@Nullable Integer amountMultiplier) {
+ this.amountMultiplier = amountMultiplier;
+ }
+
+ /**
+ * Adds values: -3..3, The amountMultiplier defines the exponent to base 10 (dec). The final value
+ * is determined by: amount * 10 ^ amountMultiplier
+ *
+ * @param amountMultiplier Values: -3..3, The amountMultiplier defines the exponent to base 10
+ * (dec)
+ * @return this
+ */
+ public Cost withAmountMultiplier(@Nullable Integer amountMultiplier) {
+ setAmountMultiplier(amountMultiplier);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidCostKind(costKind) && isValidAmount(amount);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Cost that = (Cost) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(costKind, that.costKind)
+ && Objects.equals(amount, that.amount)
+ && Objects.equals(amountMultiplier, that.amountMultiplier);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, costKind, amount, amountMultiplier);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("costKind", costKind)
+ .add("amount", amount)
+ .add("amountMultiplier", amountMultiplier)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CostKindEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CostKindEnum.java
new file mode 100644
index 000000000..c85179622
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CostKindEnum.java
@@ -0,0 +1,36 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Cost. Cost Kind. Cost Kind Code
+ *
+ * The kind of cost referred to in the message element amount
+ */
+public enum CostKindEnum {
+ CarbonDioxideEmission,
+ RelativePricePercentage,
+ RenewableGenerationPercentage
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CustomData.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CustomData.java
new file mode 100644
index 000000000..c50b3a42d
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CustomData.java
@@ -0,0 +1,104 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+
+/** Custom data */
+public class CustomData {
+ /** vendorId */
+ private String vendorId;
+
+ /**
+ * Constructor for the CustomData class
+ *
+ * @param vendorId vendorId
+ */
+ public CustomData(String vendorId) {
+ setVendorId(vendorId);
+ }
+
+ /**
+ * Gets vendorId
+ *
+ * @return vendorId
+ */
+ public String getVendorId() {
+ return vendorId;
+ }
+
+ /**
+ * Sets vendorId
+ *
+ * @param vendorId vendorId
+ */
+ public void setVendorId(String vendorId) {
+ if (!isValidVendorId(vendorId)) {
+ throw new PropertyConstraintException(vendorId, "vendorId is invalid");
+ }
+ this.vendorId = vendorId;
+ }
+
+ /**
+ * Returns whether the given vendorId is valid
+ *
+ * @param vendorId the vendorId to check the validity of
+ * @return {@code true} if vendorId is valid, {@code false} if not
+ */
+ private boolean isValidVendorId(String vendorId) {
+ return vendorId != null && vendorId.length() <= 255;
+ }
+
+ public boolean validate() {
+ return isValidVendorId(vendorId);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CustomData that = (CustomData) o;
+ return Objects.equals(vendorId, that.vendorId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(vendorId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("vendorId", vendorId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CustomerInformationStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CustomerInformationStatusEnum.java
new file mode 100644
index 000000000..005fa21c8
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CustomerInformationStatusEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether the request was accepted. */
+public enum CustomerInformationStatusEnum {
+ Accepted,
+ Rejected,
+ Invalid
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DCChargingParameters.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DCChargingParameters.java
new file mode 100644
index 000000000..11f11eb90
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DCChargingParameters.java
@@ -0,0 +1,499 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * DC Charging Parameters
+ *
+ * EV DC charging parameters
+ */
+public final class DCChargingParameters {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * DC Charging Parameters. EV Max. Current
+ *
+ * Maximum current (amps) supported by the electric vehicle. Includes cable capacity.
+ */
+ private Integer evMaxCurrent;
+
+ /**
+ * DC Charging Parameters. EV Max. Voltage
+ *
+ * Maximum voltage supported by the electric vehicle
+ */
+ private Integer evMaxVoltage;
+
+ /**
+ * DC Charging Parameters. Energy Amount. Energy Amount
+ *
+ * Amount of energy requested (in Wh). This inludes energy required for preconditioning.
+ */
+ @Nullable private Integer energyAmount;
+
+ /**
+ * DC Charging Parameters. EV Max. Power
+ *
+ * Maximum power (in W) supported by the electric vehicle. Required for DC charging.
+ */
+ @Nullable private Integer evMaxPower;
+
+ /**
+ * DC Charging Parameters. State Of Charge. Numeric
+ *
+ * Energy available in the battery (in percent of the battery capacity)
+ */
+ @Nullable private Integer stateOfCharge;
+
+ /**
+ * DC Charging Parameters. EV Energy Capacity. Numeric
+ *
+ * Capacity of the electric vehicle battery (in Wh)
+ */
+ @Nullable private Integer evEnergyCapacity;
+
+ /**
+ * DC Charging Parameters. Full SOC. Percentage
+ *
+ * Percentage of SoC at which the EV considers the battery fully charged. (possible values: 0 -
+ * 100)
+ */
+ @Nullable private Integer fullSoC;
+
+ /**
+ * DC Charging Parameters. Bulk SOC. Percentage
+ *
+ * Percentage of SoC at which the EV considers a fast charging process to end. (possible
+ * values: 0 - 100)
+ */
+ @Nullable private Integer bulkSoC;
+
+ /**
+ * Constructor for the DCChargingParameters class
+ *
+ * @param evMaxCurrent Maximum current (amps) supported by the electric vehicle. Includes cable
+ * capacity.
+ * @param evMaxVoltage Maximum voltage supported by the electric vehicle
+ */
+ public DCChargingParameters(Integer evMaxCurrent, Integer evMaxVoltage) {
+ setEvMaxCurrent(evMaxCurrent);
+ setEvMaxVoltage(evMaxVoltage);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public DCChargingParameters withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets maximum current (amps) supported by the electric vehicle. Includes cable capacity.
+ *
+ * @return Maximum current (amps) supported by the electric vehicle
+ */
+ public Integer getEvMaxCurrent() {
+ return evMaxCurrent;
+ }
+
+ /**
+ * Sets maximum current (amps) supported by the electric vehicle. Includes cable capacity.
+ *
+ * @param evMaxCurrent Maximum current (amps) supported by the electric vehicle
+ */
+ public void setEvMaxCurrent(Integer evMaxCurrent) {
+ if (!isValidEvMaxCurrent(evMaxCurrent)) {
+ throw new PropertyConstraintException(evMaxCurrent, "evMaxCurrent is invalid");
+ }
+ this.evMaxCurrent = evMaxCurrent;
+ }
+
+ /**
+ * Returns whether the given evMaxCurrent is valid
+ *
+ * @param evMaxCurrent the evMaxCurrent to check the validity of
+ * @return {@code true} if evMaxCurrent is valid, {@code false} if not
+ */
+ private boolean isValidEvMaxCurrent(Integer evMaxCurrent) {
+ return evMaxCurrent != null;
+ }
+
+ /**
+ * Gets maximum voltage supported by the electric vehicle
+ *
+ * @return Maximum voltage supported by the electric vehicle
+ */
+ public Integer getEvMaxVoltage() {
+ return evMaxVoltage;
+ }
+
+ /**
+ * Sets maximum voltage supported by the electric vehicle
+ *
+ * @param evMaxVoltage Maximum voltage supported by the electric vehicle
+ */
+ public void setEvMaxVoltage(Integer evMaxVoltage) {
+ if (!isValidEvMaxVoltage(evMaxVoltage)) {
+ throw new PropertyConstraintException(evMaxVoltage, "evMaxVoltage is invalid");
+ }
+ this.evMaxVoltage = evMaxVoltage;
+ }
+
+ /**
+ * Returns whether the given evMaxVoltage is valid
+ *
+ * @param evMaxVoltage the evMaxVoltage to check the validity of
+ * @return {@code true} if evMaxVoltage is valid, {@code false} if not
+ */
+ private boolean isValidEvMaxVoltage(Integer evMaxVoltage) {
+ return evMaxVoltage != null;
+ }
+
+ /**
+ * Gets amount of energy requested (in Wh). This inludes energy required for preconditioning.
+ *
+ * @return Amount of energy requested (in Wh)
+ */
+ @Nullable
+ public Integer getEnergyAmount() {
+ return energyAmount;
+ }
+
+ /**
+ * Sets amount of energy requested (in Wh). This inludes energy required for preconditioning.
+ *
+ * @param energyAmount Amount of energy requested (in Wh)
+ */
+ public void setEnergyAmount(@Nullable Integer energyAmount) {
+ this.energyAmount = energyAmount;
+ }
+
+ /**
+ * Adds amount of energy requested (in Wh). This inludes energy required for preconditioning.
+ *
+ * @param energyAmount Amount of energy requested (in Wh)
+ * @return this
+ */
+ public DCChargingParameters withEnergyAmount(@Nullable Integer energyAmount) {
+ setEnergyAmount(energyAmount);
+ return this;
+ }
+
+ /**
+ * Gets maximum power (in W) supported by the electric vehicle. Required for DC charging.
+ *
+ * @return Maximum power (in W) supported by the electric vehicle
+ */
+ @Nullable
+ public Integer getEvMaxPower() {
+ return evMaxPower;
+ }
+
+ /**
+ * Sets maximum power (in W) supported by the electric vehicle. Required for DC charging.
+ *
+ * @param evMaxPower Maximum power (in W) supported by the electric vehicle
+ */
+ public void setEvMaxPower(@Nullable Integer evMaxPower) {
+ this.evMaxPower = evMaxPower;
+ }
+
+ /**
+ * Adds maximum power (in W) supported by the electric vehicle. Required for DC charging.
+ *
+ * @param evMaxPower Maximum power (in W) supported by the electric vehicle
+ * @return this
+ */
+ public DCChargingParameters withEvMaxPower(@Nullable Integer evMaxPower) {
+ setEvMaxPower(evMaxPower);
+ return this;
+ }
+
+ /**
+ * Gets energy available in the battery (in percent of the battery capacity)
+ *
+ * @return Energy available in the battery (in percent of the battery capacity)
+ */
+ @Nullable
+ public Integer getStateOfCharge() {
+ return stateOfCharge;
+ }
+
+ /**
+ * Sets energy available in the battery (in percent of the battery capacity)
+ *
+ * @param stateOfCharge Energy available in the battery (in percent of the battery capacity)
+ */
+ public void setStateOfCharge(@Nullable Integer stateOfCharge) {
+ if (!isValidStateOfCharge(stateOfCharge)) {
+ throw new PropertyConstraintException(stateOfCharge, "stateOfCharge is invalid");
+ }
+ this.stateOfCharge = stateOfCharge;
+ }
+
+ /**
+ * Returns whether the given stateOfCharge is valid
+ *
+ * @param stateOfCharge the stateOfCharge to check the validity of
+ * @return {@code true} if stateOfCharge is valid, {@code false} if not
+ */
+ private boolean isValidStateOfCharge(@Nullable Integer stateOfCharge) {
+ return stateOfCharge == null || (stateOfCharge >= 0 && stateOfCharge <= 100);
+ }
+
+ /**
+ * Adds energy available in the battery (in percent of the battery capacity)
+ *
+ * @param stateOfCharge Energy available in the battery (in percent of the battery capacity)
+ * @return this
+ */
+ public DCChargingParameters withStateOfCharge(@Nullable Integer stateOfCharge) {
+ setStateOfCharge(stateOfCharge);
+ return this;
+ }
+
+ /**
+ * Gets capacity of the electric vehicle battery (in Wh)
+ *
+ * @return Capacity of the electric vehicle battery (in Wh)
+ */
+ @Nullable
+ public Integer getEvEnergyCapacity() {
+ return evEnergyCapacity;
+ }
+
+ /**
+ * Sets capacity of the electric vehicle battery (in Wh)
+ *
+ * @param evEnergyCapacity Capacity of the electric vehicle battery (in Wh)
+ */
+ public void setEvEnergyCapacity(@Nullable Integer evEnergyCapacity) {
+ this.evEnergyCapacity = evEnergyCapacity;
+ }
+
+ /**
+ * Adds capacity of the electric vehicle battery (in Wh)
+ *
+ * @param evEnergyCapacity Capacity of the electric vehicle battery (in Wh)
+ * @return this
+ */
+ public DCChargingParameters withEvEnergyCapacity(@Nullable Integer evEnergyCapacity) {
+ setEvEnergyCapacity(evEnergyCapacity);
+ return this;
+ }
+
+ /**
+ * Gets percentage of SoC at which the EV considers the battery fully charged. (possible values: 0
+ * - 100)
+ *
+ * @return Percentage of SoC at which the EV considers the battery fully charged
+ */
+ @Nullable
+ public Integer getFullSoC() {
+ return fullSoC;
+ }
+
+ /**
+ * Sets percentage of SoC at which the EV considers the battery fully charged. (possible values: 0
+ * - 100)
+ *
+ * @param fullSoC Percentage of SoC at which the EV considers the battery fully charged
+ */
+ public void setFullSoC(@Nullable Integer fullSoC) {
+ if (!isValidFullSoC(fullSoC)) {
+ throw new PropertyConstraintException(fullSoC, "fullSoC is invalid");
+ }
+ this.fullSoC = fullSoC;
+ }
+
+ /**
+ * Returns whether the given fullSoC is valid
+ *
+ * @param fullSoC the fullSoC to check the validity of
+ * @return {@code true} if fullSoC is valid, {@code false} if not
+ */
+ private boolean isValidFullSoC(@Nullable Integer fullSoC) {
+ return fullSoC == null || (fullSoC >= 0 && fullSoC <= 100);
+ }
+
+ /**
+ * Adds percentage of SoC at which the EV considers the battery fully charged. (possible values: 0
+ * - 100)
+ *
+ * @param fullSoC Percentage of SoC at which the EV considers the battery fully charged
+ * @return this
+ */
+ public DCChargingParameters withFullSoC(@Nullable Integer fullSoC) {
+ setFullSoC(fullSoC);
+ return this;
+ }
+
+ /**
+ * Gets percentage of SoC at which the EV considers a fast charging process to end. (possible
+ * values: 0 - 100)
+ *
+ * @return Percentage of SoC at which the EV considers a fast charging process to end
+ */
+ @Nullable
+ public Integer getBulkSoC() {
+ return bulkSoC;
+ }
+
+ /**
+ * Sets percentage of SoC at which the EV considers a fast charging process to end. (possible
+ * values: 0 - 100)
+ *
+ * @param bulkSoC Percentage of SoC at which the EV considers a fast charging process to end
+ */
+ public void setBulkSoC(@Nullable Integer bulkSoC) {
+ if (!isValidBulkSoC(bulkSoC)) {
+ throw new PropertyConstraintException(bulkSoC, "bulkSoC is invalid");
+ }
+ this.bulkSoC = bulkSoC;
+ }
+
+ /**
+ * Returns whether the given bulkSoC is valid
+ *
+ * @param bulkSoC the bulkSoC to check the validity of
+ * @return {@code true} if bulkSoC is valid, {@code false} if not
+ */
+ private boolean isValidBulkSoC(@Nullable Integer bulkSoC) {
+ return bulkSoC == null || (bulkSoC >= 0 && bulkSoC <= 100);
+ }
+
+ /**
+ * Adds percentage of SoC at which the EV considers a fast charging process to end. (possible
+ * values: 0 - 100)
+ *
+ * @param bulkSoC Percentage of SoC at which the EV considers a fast charging process to end
+ * @return this
+ */
+ public DCChargingParameters withBulkSoC(@Nullable Integer bulkSoC) {
+ setBulkSoC(bulkSoC);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidEvMaxCurrent(evMaxCurrent)
+ && isValidEvMaxVoltage(evMaxVoltage)
+ && isValidStateOfCharge(stateOfCharge)
+ && isValidFullSoC(fullSoC)
+ && isValidBulkSoC(bulkSoC);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ DCChargingParameters that = (DCChargingParameters) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(evMaxCurrent, that.evMaxCurrent)
+ && Objects.equals(evMaxVoltage, that.evMaxVoltage)
+ && Objects.equals(energyAmount, that.energyAmount)
+ && Objects.equals(evMaxPower, that.evMaxPower)
+ && Objects.equals(stateOfCharge, that.stateOfCharge)
+ && Objects.equals(evEnergyCapacity, that.evEnergyCapacity)
+ && Objects.equals(fullSoC, that.fullSoC)
+ && Objects.equals(bulkSoC, that.bulkSoC);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ evMaxCurrent,
+ evMaxVoltage,
+ energyAmount,
+ evMaxPower,
+ stateOfCharge,
+ evEnergyCapacity,
+ fullSoC,
+ bulkSoC);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("evMaxCurrent", evMaxCurrent)
+ .add("evMaxVoltage", evMaxVoltage)
+ .add("energyAmount", energyAmount)
+ .add("evMaxPower", evMaxPower)
+ .add("stateOfCharge", stateOfCharge)
+ .add("evEnergyCapacity", evEnergyCapacity)
+ .add("fullSoC", fullSoC)
+ .add("bulkSoC", bulkSoC)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DataEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DataEnum.java
new file mode 100644
index 000000000..2b1b86eaf
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DataEnum.java
@@ -0,0 +1,40 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import com.google.gson.annotations.SerializedName;
+
+/** Data type of this variable. */
+public enum DataEnum {
+ string,
+ decimal,
+ integer,
+ dateTime,
+ @SerializedName("boolean")
+ booleanType,
+ OptionList,
+ SequenceList,
+ MemberList
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DataTransferStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DataTransferStatusEnum.java
new file mode 100644
index 000000000..e4f9e0665
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DataTransferStatusEnum.java
@@ -0,0 +1,33 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The success or failure of the data transfer. */
+public enum DataTransferStatusEnum {
+ Accepted,
+ Rejected,
+ UnknownMessageId,
+ UnknownVendorId
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DeleteCertificateStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DeleteCertificateStatusEnum.java
new file mode 100644
index 000000000..9be3d8764
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DeleteCertificateStatusEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Charging Station indicates if it can process the request. */
+public enum DeleteCertificateStatusEnum {
+ Accepted,
+ Failed,
+ NotFound
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DisplayMessageStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DisplayMessageStatusEnum.java
new file mode 100644
index 000000000..0ab42d237
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/DisplayMessageStatusEnum.java
@@ -0,0 +1,35 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether the Charging Station is able to display the message. */
+public enum DisplayMessageStatusEnum {
+ Accepted,
+ NotSupportedMessageFormat,
+ Rejected,
+ NotSupportedPriority,
+ NotSupportedState,
+ UnknownTransaction
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EVSE.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EVSE.java
new file mode 100644
index 000000000..2f709ffcc
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EVSE.java
@@ -0,0 +1,202 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * EVSE
+ *
+ * Electric Vehicle Supply Equipment
+ */
+public final class EVSE {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Identified Object. MRID. Numeric Identifier
+ *
+ * EVSE Identifier. This contains a number (greater than 0) designating an EVSE of the Charging
+ * Station.
+ */
+ private Integer id;
+
+ /** An id to designate a specific connector (on an EVSE) by connector index number. */
+ @Nullable private Integer connectorId;
+
+ /**
+ * Constructor for the EVSE class
+ *
+ * @param id EVSE Identifier. This contains a number (greater than 0) designating an EVSE of the
+ * Charging Station.
+ */
+ public EVSE(Integer id) {
+ setId(id);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public EVSE withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets EVSE Identifier. This contains a number (greater than 0) designating an EVSE of the
+ * Charging Station.
+ *
+ * @return EVSE Identifier
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * Sets EVSE Identifier. This contains a number (greater than 0) designating an EVSE of the
+ * Charging Station.
+ *
+ * @param id EVSE Identifier
+ */
+ public void setId(Integer id) {
+ if (!isValidId(id)) {
+ throw new PropertyConstraintException(id, "id is invalid");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Returns whether the given id is valid
+ *
+ * @param id the id to check the validity of
+ * @return {@code true} if id is valid, {@code false} if not
+ */
+ private boolean isValidId(Integer id) {
+ return id != null;
+ }
+
+ /**
+ * Gets an id to designate a specific connector (on an EVSE) by connector index number.
+ *
+ * @return An id to designate a specific connector (on an EVSE) by connector index number
+ */
+ @Nullable
+ public Integer getConnectorId() {
+ return connectorId;
+ }
+
+ /**
+ * Sets an id to designate a specific connector (on an EVSE) by connector index number.
+ *
+ * @param connectorId An id to designate a specific connector (on an EVSE) by connector index
+ * number
+ */
+ public void setConnectorId(@Nullable Integer connectorId) {
+ this.connectorId = connectorId;
+ }
+
+ /**
+ * Adds an id to designate a specific connector (on an EVSE) by connector index number.
+ *
+ * @param connectorId An id to designate a specific connector (on an EVSE) by connector index
+ * number
+ * @return this
+ */
+ public EVSE withConnectorId(@Nullable Integer connectorId) {
+ setConnectorId(connectorId);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidId(id);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ EVSE that = (EVSE) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(id, that.id)
+ && Objects.equals(connectorId, that.connectorId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, id, connectorId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("id", id)
+ .add("connectorId", connectorId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EnergyTransferModeEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EnergyTransferModeEnum.java
new file mode 100644
index 000000000..5c0bedad2
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EnergyTransferModeEnum.java
@@ -0,0 +1,37 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Charging Needs. Requested. Energy Transfer Mode Code
+ *
+ * Mode of energy transfer requested by the EV.
+ */
+public enum EnergyTransferModeEnum {
+ DC,
+ AC_single_phase,
+ AC_two_phase,
+ AC_three_phase
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EventData.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EventData.java
new file mode 100644
index 000000000..df473d9af
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EventData.java
@@ -0,0 +1,688 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Class to report an event notification for a component-variable. */
+public final class EventData {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The identifier of the event. This field can be referred to as a cause by other events. */
+ private Integer eventId;
+
+ /** Timestamp of the moment the report was generated. */
+ private ZonedDateTime timestamp;
+
+ /** Type of monitor that triggered this event, e.g. exceeding a threshold value. */
+ private EventTriggerEnum trigger;
+
+ /** Refers to the Id of an event that is considered to be the cause for this event. */
+ @Nullable private Integer cause;
+
+ /**
+ * Actual value (attributeType Actual) of the variable.
+ *
+ * The Configuration Variable ReportingValueSize can be used to limit
+ * GetVariableResult.attributeValue, VariableAttribute.value and EventData.actualValue. The max
+ * size of these values will always remain equal.
+ */
+ private String actualValue;
+
+ /** Technical (error) code as reported by component. */
+ @Nullable private String techCode;
+
+ /** Technical detail information as reported by component. */
+ @Nullable private String techInfo;
+
+ /**
+ * Cleared is set to true to report the clearing of a monitored situation, i.e. a 'return to
+ * normal'.
+ */
+ @Nullable private Boolean cleared;
+
+ /**
+ * If an event notification is linked to a specific transaction, this field can be used to specify
+ * its transactionId.
+ */
+ @Nullable private String transactionId;
+
+ /** A physical or logical component */
+ private Component component;
+
+ /** The identifier of the VariableMonitoring which triggered the event. */
+ @Nullable private Integer variableMonitoringId;
+
+ /** Specifies the event notification type of the message. */
+ private EventNotificationEnum eventNotificationType;
+
+ /** Reference key to a component-variable. */
+ private Variable variable;
+
+ /**
+ * Constructor for the EventData class
+ *
+ * @param eventId The identifier of the event. This field can be referred to as a cause by other
+ * events.
+ * @param timestamp Timestamp of the moment the report was generated.
+ * @param trigger Type of monitor that triggered this event, e.g. exceeding a threshold value.
+ * @param actualValue Actual value (attributeType Actual) of the variable.
+ * @param component A physical or logical component
+ * @param eventNotificationType Specifies the event notification type of the message.
+ * @param variable Reference key to a component-variable.
+ */
+ public EventData(
+ Integer eventId,
+ ZonedDateTime timestamp,
+ EventTriggerEnum trigger,
+ String actualValue,
+ Component component,
+ EventNotificationEnum eventNotificationType,
+ Variable variable) {
+ setEventId(eventId);
+ setTimestamp(timestamp);
+ setTrigger(trigger);
+ setActualValue(actualValue);
+ setComponent(component);
+ setEventNotificationType(eventNotificationType);
+ setVariable(variable);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public EventData withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the identifier of the event. This field can be referred to as a cause by other events.
+ *
+ * @return The identifier of the event
+ */
+ public Integer getEventId() {
+ return eventId;
+ }
+
+ /**
+ * Sets the identifier of the event. This field can be referred to as a cause by other events.
+ *
+ * @param eventId The identifier of the event
+ */
+ public void setEventId(Integer eventId) {
+ if (!isValidEventId(eventId)) {
+ throw new PropertyConstraintException(eventId, "eventId is invalid");
+ }
+ this.eventId = eventId;
+ }
+
+ /**
+ * Returns whether the given eventId is valid
+ *
+ * @param eventId the eventId to check the validity of
+ * @return {@code true} if eventId is valid, {@code false} if not
+ */
+ private boolean isValidEventId(Integer eventId) {
+ return eventId != null;
+ }
+
+ /**
+ * Gets timestamp of the moment the report was generated.
+ *
+ * @return Timestamp of the moment the report was generated
+ */
+ public ZonedDateTime getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * Sets timestamp of the moment the report was generated.
+ *
+ * @param timestamp Timestamp of the moment the report was generated
+ */
+ public void setTimestamp(ZonedDateTime timestamp) {
+ if (!isValidTimestamp(timestamp)) {
+ throw new PropertyConstraintException(timestamp, "timestamp is invalid");
+ }
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * Returns whether the given timestamp is valid
+ *
+ * @param timestamp the timestamp to check the validity of
+ * @return {@code true} if timestamp is valid, {@code false} if not
+ */
+ private boolean isValidTimestamp(ZonedDateTime timestamp) {
+ return timestamp != null;
+ }
+
+ /**
+ * Gets type of monitor that triggered this event, e.g. exceeding a threshold value.
+ *
+ * @return Type of monitor that triggered this event, e.g. exceeding a threshold value
+ */
+ public EventTriggerEnum getTrigger() {
+ return trigger;
+ }
+
+ /**
+ * Sets type of monitor that triggered this event, e.g. exceeding a threshold value.
+ *
+ * @param trigger Type of monitor that triggered this event, e.g. exceeding a threshold value
+ */
+ public void setTrigger(EventTriggerEnum trigger) {
+ if (!isValidTrigger(trigger)) {
+ throw new PropertyConstraintException(trigger, "trigger is invalid");
+ }
+ this.trigger = trigger;
+ }
+
+ /**
+ * Returns whether the given trigger is valid
+ *
+ * @param trigger the trigger to check the validity of
+ * @return {@code true} if trigger is valid, {@code false} if not
+ */
+ private boolean isValidTrigger(EventTriggerEnum trigger) {
+ return trigger != null;
+ }
+
+ /**
+ * Gets refers to the Id of an event that is considered to be the cause for this event.
+ *
+ * @return Refers to the Id of an event that is considered to be the cause for this event
+ */
+ @Nullable
+ public Integer getCause() {
+ return cause;
+ }
+
+ /**
+ * Sets refers to the Id of an event that is considered to be the cause for this event.
+ *
+ * @param cause Refers to the Id of an event that is considered to be the cause for this event
+ */
+ public void setCause(@Nullable Integer cause) {
+ this.cause = cause;
+ }
+
+ /**
+ * Adds refers to the Id of an event that is considered to be the cause for this event.
+ *
+ * @param cause Refers to the Id of an event that is considered to be the cause for this event
+ * @return this
+ */
+ public EventData withCause(@Nullable Integer cause) {
+ setCause(cause);
+ return this;
+ }
+
+ /**
+ * Gets actual value (attributeType Actual) of the variable.
+ *
+ * @return Actual value (attributeType Actual) of the variable
+ */
+ public String getActualValue() {
+ return actualValue;
+ }
+
+ /**
+ * Sets actual value (attributeType Actual) of the variable.
+ *
+ * @param actualValue Actual value (attributeType Actual) of the variable
+ */
+ public void setActualValue(String actualValue) {
+ if (!isValidActualValue(actualValue)) {
+ throw new PropertyConstraintException(actualValue, "actualValue is invalid");
+ }
+ this.actualValue = actualValue;
+ }
+
+ /**
+ * Returns whether the given actualValue is valid
+ *
+ * @param actualValue the actualValue to check the validity of
+ * @return {@code true} if actualValue is valid, {@code false} if not
+ */
+ private boolean isValidActualValue(String actualValue) {
+ return actualValue != null && actualValue.length() <= 2500;
+ }
+
+ /**
+ * Gets technical (error) code as reported by component.
+ *
+ * @return Technical (error) code as reported by component
+ */
+ @Nullable
+ public String getTechCode() {
+ return techCode;
+ }
+
+ /**
+ * Sets technical (error) code as reported by component.
+ *
+ * @param techCode Technical (error) code as reported by component
+ */
+ public void setTechCode(@Nullable String techCode) {
+ if (!isValidTechCode(techCode)) {
+ throw new PropertyConstraintException(techCode, "techCode is invalid");
+ }
+ this.techCode = techCode;
+ }
+
+ /**
+ * Returns whether the given techCode is valid
+ *
+ * @param techCode the techCode to check the validity of
+ * @return {@code true} if techCode is valid, {@code false} if not
+ */
+ private boolean isValidTechCode(@Nullable String techCode) {
+ return techCode == null || techCode.length() <= 50;
+ }
+
+ /**
+ * Adds technical (error) code as reported by component.
+ *
+ * @param techCode Technical (error) code as reported by component
+ * @return this
+ */
+ public EventData withTechCode(@Nullable String techCode) {
+ setTechCode(techCode);
+ return this;
+ }
+
+ /**
+ * Gets technical detail information as reported by component.
+ *
+ * @return Technical detail information as reported by component
+ */
+ @Nullable
+ public String getTechInfo() {
+ return techInfo;
+ }
+
+ /**
+ * Sets technical detail information as reported by component.
+ *
+ * @param techInfo Technical detail information as reported by component
+ */
+ public void setTechInfo(@Nullable String techInfo) {
+ if (!isValidTechInfo(techInfo)) {
+ throw new PropertyConstraintException(techInfo, "techInfo is invalid");
+ }
+ this.techInfo = techInfo;
+ }
+
+ /**
+ * Returns whether the given techInfo is valid
+ *
+ * @param techInfo the techInfo to check the validity of
+ * @return {@code true} if techInfo is valid, {@code false} if not
+ */
+ private boolean isValidTechInfo(@Nullable String techInfo) {
+ return techInfo == null || techInfo.length() <= 500;
+ }
+
+ /**
+ * Adds technical detail information as reported by component.
+ *
+ * @param techInfo Technical detail information as reported by component
+ * @return this
+ */
+ public EventData withTechInfo(@Nullable String techInfo) {
+ setTechInfo(techInfo);
+ return this;
+ }
+
+ /**
+ * Gets cleared is set to true to report the clearing of a monitored situation, i.e. a 'return to
+ * normal'.
+ *
+ * @return Cleared is set to true to report the clearing of a monitored situation, i.e. a 'return
+ * to normal'
+ */
+ @Nullable
+ public Boolean getCleared() {
+ return cleared;
+ }
+
+ /**
+ * Sets cleared is set to true to report the clearing of a monitored situation, i.e. a 'return to
+ * normal'.
+ *
+ * @param cleared Cleared is set to true to report the clearing of a monitored situation, i.e. a
+ * 'return to normal'
+ */
+ public void setCleared(@Nullable Boolean cleared) {
+ this.cleared = cleared;
+ }
+
+ /**
+ * Adds cleared is set to true to report the clearing of a monitored situation, i.e. a 'return to
+ * normal'.
+ *
+ * @param cleared Cleared is set to true to report the clearing of a monitored situation, i.e. a
+ * 'return to normal'
+ * @return this
+ */
+ public EventData withCleared(@Nullable Boolean cleared) {
+ setCleared(cleared);
+ return this;
+ }
+
+ /**
+ * Gets if an event notification is linked to a specific transaction, this field can be used to
+ * specify its transactionId.
+ *
+ * @return If an event notification is linked to a specific transaction, this field can be used to
+ * specify its transactionId
+ */
+ @Nullable
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ /**
+ * Sets if an event notification is linked to a specific transaction, this field can be used to
+ * specify its transactionId.
+ *
+ * @param transactionId If an event notification is linked to a specific transaction, this field
+ * can be used to specify its transactionId
+ */
+ public void setTransactionId(@Nullable String transactionId) {
+ if (!isValidTransactionId(transactionId)) {
+ throw new PropertyConstraintException(transactionId, "transactionId is invalid");
+ }
+ this.transactionId = transactionId;
+ }
+
+ /**
+ * Returns whether the given transactionId is valid
+ *
+ * @param transactionId the transactionId to check the validity of
+ * @return {@code true} if transactionId is valid, {@code false} if not
+ */
+ private boolean isValidTransactionId(@Nullable String transactionId) {
+ return transactionId == null || transactionId.length() <= 36;
+ }
+
+ /**
+ * Adds if an event notification is linked to a specific transaction, this field can be used to
+ * specify its transactionId.
+ *
+ * @param transactionId If an event notification is linked to a specific transaction, this field
+ * can be used to specify its transactionId
+ * @return this
+ */
+ public EventData withTransactionId(@Nullable String transactionId) {
+ setTransactionId(transactionId);
+ return this;
+ }
+
+ /**
+ * Gets a physical or logical component
+ *
+ * @return A physical or logical component
+ */
+ public Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets a physical or logical component
+ *
+ * @param component A physical or logical component
+ */
+ public void setComponent(Component component) {
+ if (!isValidComponent(component)) {
+ throw new PropertyConstraintException(component, "component is invalid");
+ }
+ this.component = component;
+ }
+
+ /**
+ * Returns whether the given component is valid
+ *
+ * @param component the component to check the validity of
+ * @return {@code true} if component is valid, {@code false} if not
+ */
+ private boolean isValidComponent(Component component) {
+ return component != null && component.validate();
+ }
+
+ /**
+ * Gets the identifier of the VariableMonitoring which triggered the event.
+ *
+ * @return The identifier of the VariableMonitoring which triggered the event
+ */
+ @Nullable
+ public Integer getVariableMonitoringId() {
+ return variableMonitoringId;
+ }
+
+ /**
+ * Sets the identifier of the VariableMonitoring which triggered the event.
+ *
+ * @param variableMonitoringId The identifier of the VariableMonitoring which triggered the event
+ */
+ public void setVariableMonitoringId(@Nullable Integer variableMonitoringId) {
+ this.variableMonitoringId = variableMonitoringId;
+ }
+
+ /**
+ * Adds the identifier of the VariableMonitoring which triggered the event.
+ *
+ * @param variableMonitoringId The identifier of the VariableMonitoring which triggered the event
+ * @return this
+ */
+ public EventData withVariableMonitoringId(@Nullable Integer variableMonitoringId) {
+ setVariableMonitoringId(variableMonitoringId);
+ return this;
+ }
+
+ /**
+ * Gets specifies the event notification type of the message.
+ *
+ * @return Specifies the event notification type of the message
+ */
+ public EventNotificationEnum getEventNotificationType() {
+ return eventNotificationType;
+ }
+
+ /**
+ * Sets specifies the event notification type of the message.
+ *
+ * @param eventNotificationType Specifies the event notification type of the message
+ */
+ public void setEventNotificationType(EventNotificationEnum eventNotificationType) {
+ if (!isValidEventNotificationType(eventNotificationType)) {
+ throw new PropertyConstraintException(
+ eventNotificationType, "eventNotificationType is invalid");
+ }
+ this.eventNotificationType = eventNotificationType;
+ }
+
+ /**
+ * Returns whether the given eventNotificationType is valid
+ *
+ * @param eventNotificationType the eventNotificationType to check the validity of
+ * @return {@code true} if eventNotificationType is valid, {@code false} if not
+ */
+ private boolean isValidEventNotificationType(EventNotificationEnum eventNotificationType) {
+ return eventNotificationType != null;
+ }
+
+ /**
+ * Gets reference key to a component-variable.
+ *
+ * @return Reference key to a component-variable
+ */
+ public Variable getVariable() {
+ return variable;
+ }
+
+ /**
+ * Sets reference key to a component-variable.
+ *
+ * @param variable Reference key to a component-variable
+ */
+ public void setVariable(Variable variable) {
+ if (!isValidVariable(variable)) {
+ throw new PropertyConstraintException(variable, "variable is invalid");
+ }
+ this.variable = variable;
+ }
+
+ /**
+ * Returns whether the given variable is valid
+ *
+ * @param variable the variable to check the validity of
+ * @return {@code true} if variable is valid, {@code false} if not
+ */
+ private boolean isValidVariable(Variable variable) {
+ return variable != null && variable.validate();
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidEventId(eventId)
+ && isValidTimestamp(timestamp)
+ && isValidTrigger(trigger)
+ && isValidActualValue(actualValue)
+ && isValidTechCode(techCode)
+ && isValidTechInfo(techInfo)
+ && isValidTransactionId(transactionId)
+ && isValidComponent(component)
+ && isValidEventNotificationType(eventNotificationType)
+ && isValidVariable(variable);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ EventData that = (EventData) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(eventId, that.eventId)
+ && Objects.equals(timestamp, that.timestamp)
+ && Objects.equals(trigger, that.trigger)
+ && Objects.equals(cause, that.cause)
+ && Objects.equals(actualValue, that.actualValue)
+ && Objects.equals(techCode, that.techCode)
+ && Objects.equals(techInfo, that.techInfo)
+ && Objects.equals(cleared, that.cleared)
+ && Objects.equals(transactionId, that.transactionId)
+ && Objects.equals(component, that.component)
+ && Objects.equals(variableMonitoringId, that.variableMonitoringId)
+ && Objects.equals(eventNotificationType, that.eventNotificationType)
+ && Objects.equals(variable, that.variable);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ eventId,
+ timestamp,
+ trigger,
+ cause,
+ actualValue,
+ techCode,
+ techInfo,
+ cleared,
+ transactionId,
+ component,
+ variableMonitoringId,
+ eventNotificationType,
+ variable);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("eventId", eventId)
+ .add("timestamp", timestamp)
+ .add("trigger", trigger)
+ .add("cause", cause)
+ .add("actualValue", actualValue)
+ .add("techCode", techCode)
+ .add("techInfo", techInfo)
+ .add("cleared", cleared)
+ .add("transactionId", transactionId)
+ .add("component", component)
+ .add("variableMonitoringId", variableMonitoringId)
+ .add("eventNotificationType", eventNotificationType)
+ .add("variable", variable)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EventNotificationEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EventNotificationEnum.java
new file mode 100644
index 000000000..fbe50d1e9
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EventNotificationEnum.java
@@ -0,0 +1,33 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Specifies the event notification type of the message. */
+public enum EventNotificationEnum {
+ HardWiredNotification,
+ HardWiredMonitor,
+ PreconfiguredMonitor,
+ CustomMonitor
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EventTriggerEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EventTriggerEnum.java
new file mode 100644
index 000000000..a7d07ca3a
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/EventTriggerEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Type of monitor that triggered this event, e.g. exceeding a threshold value. */
+public enum EventTriggerEnum {
+ Alerting,
+ Delta,
+ Periodic
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Firmware.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Firmware.java
new file mode 100644
index 000000000..7cd701455
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Firmware.java
@@ -0,0 +1,348 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Firmware
+ *
+ * A copy of the firmware that can be loaded/updated on the Charging Station.
+ */
+public final class Firmware {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Firmware. Location. URI
+ *
+ * URI defining the origin of the firmware.
+ */
+ private String location;
+
+ /**
+ * Firmware. Retrieve. Date Time
+ *
+ * Date and time at which the firmware shall be retrieved.
+ */
+ private ZonedDateTime retrieveDateTime;
+
+ /**
+ * Firmware. Install. Date Time
+ *
+ * Date and time at which the firmware shall be installed.
+ */
+ @Nullable private ZonedDateTime installDateTime;
+
+ /** Certificate with which the firmware was signed. PEM encoded X.509 certificate. */
+ @Nullable private String signingCertificate;
+
+ /**
+ * Firmware. Signature. Signature
+ *
+ * Base64 encoded firmware signature.
+ */
+ @Nullable private String signature;
+
+ /**
+ * Constructor for the Firmware class
+ *
+ * @param location URI defining the origin of the firmware.
+ * @param retrieveDateTime Date and time at which the firmware shall be retrieved.
+ */
+ public Firmware(String location, ZonedDateTime retrieveDateTime) {
+ setLocation(location);
+ setRetrieveDateTime(retrieveDateTime);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public Firmware withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets URI defining the origin of the firmware.
+ *
+ * @return URI defining the origin of the firmware
+ */
+ public String getLocation() {
+ return location;
+ }
+
+ /**
+ * Sets URI defining the origin of the firmware.
+ *
+ * @param location URI defining the origin of the firmware
+ */
+ public void setLocation(String location) {
+ if (!isValidLocation(location)) {
+ throw new PropertyConstraintException(location, "location is invalid");
+ }
+ this.location = location;
+ }
+
+ /**
+ * Returns whether the given location is valid
+ *
+ * @param location the location to check the validity of
+ * @return {@code true} if location is valid, {@code false} if not
+ */
+ private boolean isValidLocation(String location) {
+ return location != null && location.length() <= 512;
+ }
+
+ /**
+ * Gets date and time at which the firmware shall be retrieved.
+ *
+ * @return Date and time at which the firmware shall be retrieved
+ */
+ public ZonedDateTime getRetrieveDateTime() {
+ return retrieveDateTime;
+ }
+
+ /**
+ * Sets date and time at which the firmware shall be retrieved.
+ *
+ * @param retrieveDateTime Date and time at which the firmware shall be retrieved
+ */
+ public void setRetrieveDateTime(ZonedDateTime retrieveDateTime) {
+ if (!isValidRetrieveDateTime(retrieveDateTime)) {
+ throw new PropertyConstraintException(retrieveDateTime, "retrieveDateTime is invalid");
+ }
+ this.retrieveDateTime = retrieveDateTime;
+ }
+
+ /**
+ * Returns whether the given retrieveDateTime is valid
+ *
+ * @param retrieveDateTime the retrieveDateTime to check the validity of
+ * @return {@code true} if retrieveDateTime is valid, {@code false} if not
+ */
+ private boolean isValidRetrieveDateTime(ZonedDateTime retrieveDateTime) {
+ return retrieveDateTime != null;
+ }
+
+ /**
+ * Gets date and time at which the firmware shall be installed.
+ *
+ * @return Date and time at which the firmware shall be installed
+ */
+ @Nullable
+ public ZonedDateTime getInstallDateTime() {
+ return installDateTime;
+ }
+
+ /**
+ * Sets date and time at which the firmware shall be installed.
+ *
+ * @param installDateTime Date and time at which the firmware shall be installed
+ */
+ public void setInstallDateTime(@Nullable ZonedDateTime installDateTime) {
+ this.installDateTime = installDateTime;
+ }
+
+ /**
+ * Adds date and time at which the firmware shall be installed.
+ *
+ * @param installDateTime Date and time at which the firmware shall be installed
+ * @return this
+ */
+ public Firmware withInstallDateTime(@Nullable ZonedDateTime installDateTime) {
+ setInstallDateTime(installDateTime);
+ return this;
+ }
+
+ /**
+ * Gets certificate with which the firmware was signed. PEM encoded X.509 certificate.
+ *
+ * @return Certificate with which the firmware was signed
+ */
+ @Nullable
+ public String getSigningCertificate() {
+ return signingCertificate;
+ }
+
+ /**
+ * Sets certificate with which the firmware was signed. PEM encoded X.509 certificate.
+ *
+ * @param signingCertificate Certificate with which the firmware was signed
+ */
+ public void setSigningCertificate(@Nullable String signingCertificate) {
+ if (!isValidSigningCertificate(signingCertificate)) {
+ throw new PropertyConstraintException(signingCertificate, "signingCertificate is invalid");
+ }
+ this.signingCertificate = signingCertificate;
+ }
+
+ /**
+ * Returns whether the given signingCertificate is valid
+ *
+ * @param signingCertificate the signingCertificate to check the validity of
+ * @return {@code true} if signingCertificate is valid, {@code false} if not
+ */
+ private boolean isValidSigningCertificate(@Nullable String signingCertificate) {
+ return signingCertificate == null || signingCertificate.length() <= 5500;
+ }
+
+ /**
+ * Adds certificate with which the firmware was signed. PEM encoded X.509 certificate.
+ *
+ * @param signingCertificate Certificate with which the firmware was signed
+ * @return this
+ */
+ public Firmware withSigningCertificate(@Nullable String signingCertificate) {
+ setSigningCertificate(signingCertificate);
+ return this;
+ }
+
+ /**
+ * Gets base64 encoded firmware signature.
+ *
+ * @return Base64 encoded firmware signature
+ */
+ @Nullable
+ public String getSignature() {
+ return signature;
+ }
+
+ /**
+ * Sets base64 encoded firmware signature.
+ *
+ * @param signature Base64 encoded firmware signature
+ */
+ public void setSignature(@Nullable String signature) {
+ if (!isValidSignature(signature)) {
+ throw new PropertyConstraintException(signature, "signature is invalid");
+ }
+ this.signature = signature;
+ }
+
+ /**
+ * Returns whether the given signature is valid
+ *
+ * @param signature the signature to check the validity of
+ * @return {@code true} if signature is valid, {@code false} if not
+ */
+ private boolean isValidSignature(@Nullable String signature) {
+ return signature == null || signature.length() <= 800;
+ }
+
+ /**
+ * Adds base64 encoded firmware signature.
+ *
+ * @param signature Base64 encoded firmware signature
+ * @return this
+ */
+ public Firmware withSignature(@Nullable String signature) {
+ setSignature(signature);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidLocation(location)
+ && isValidRetrieveDateTime(retrieveDateTime)
+ && isValidSigningCertificate(signingCertificate)
+ && isValidSignature(signature);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Firmware that = (Firmware) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(location, that.location)
+ && Objects.equals(retrieveDateTime, that.retrieveDateTime)
+ && Objects.equals(installDateTime, that.installDateTime)
+ && Objects.equals(signingCertificate, that.signingCertificate)
+ && Objects.equals(signature, that.signature);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, location, retrieveDateTime, installDateTime, signingCertificate, signature);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("location", location)
+ .add("retrieveDateTime", retrieveDateTime)
+ .add("installDateTime", installDateTime)
+ .add("signingCertificate", signingCertificate)
+ .add("signature", signature)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/FirmwareStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/FirmwareStatusEnum.java
new file mode 100644
index 000000000..7ff0b4d17
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/FirmwareStatusEnum.java
@@ -0,0 +1,43 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The progress status of the firmware installation. */
+public enum FirmwareStatusEnum {
+ Downloaded,
+ DownloadFailed,
+ Downloading,
+ DownloadScheduled,
+ DownloadPaused,
+ Idle,
+ InstallationFailed,
+ Installing,
+ Installed,
+ InstallRebooting,
+ InstallScheduled,
+ InstallVerificationFailed,
+ InvalidSignature,
+ SignatureVerified
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GenericDeviceModelStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GenericDeviceModelStatusEnum.java
new file mode 100644
index 000000000..b58664007
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GenericDeviceModelStatusEnum.java
@@ -0,0 +1,33 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether the Charging Station was able to accept the request. */
+public enum GenericDeviceModelStatusEnum {
+ Accepted,
+ Rejected,
+ NotSupported,
+ EmptyResultSet
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GenericStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GenericStatusEnum.java
new file mode 100644
index 000000000..fb528f1dd
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GenericStatusEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Specifies whether the CSMS can process the request. */
+public enum GenericStatusEnum {
+ Accepted,
+ Rejected
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetCertificateIdUseEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetCertificateIdUseEnum.java
new file mode 100644
index 000000000..82e314687
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetCertificateIdUseEnum.java
@@ -0,0 +1,34 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The type of the requested certificate(s). */
+public enum GetCertificateIdUseEnum {
+ V2GRootCertificate,
+ MORootCertificate,
+ CSMSRootCertificate,
+ V2GCertificateChain,
+ ManufacturerRootCertificate
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetCertificateStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetCertificateStatusEnum.java
new file mode 100644
index 000000000..991acd3d9
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetCertificateStatusEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether the charging station was able to retrieve the OCSP certificate status. */
+public enum GetCertificateStatusEnum {
+ Accepted,
+ Failed
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetChargingProfileStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetChargingProfileStatusEnum.java
new file mode 100644
index 000000000..a2f8b17fb
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetChargingProfileStatusEnum.java
@@ -0,0 +1,34 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Whether the Charging Station is able to process this request and will send
+ * ReportChargingProfilesRequest messages.
+ */
+public enum GetChargingProfileStatusEnum {
+ Accepted,
+ NoProfiles
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetDisplayMessagesStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetDisplayMessagesStatusEnum.java
new file mode 100644
index 000000000..f069d8ca2
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetDisplayMessagesStatusEnum.java
@@ -0,0 +1,34 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Whether the Charging Station has Display Messages that match the request criteria in the
+ * GetDisplayMessagesRequest
+ */
+public enum GetDisplayMessagesStatusEnum {
+ Accepted,
+ Unknown
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetInstalledCertificateStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetInstalledCertificateStatusEnum.java
new file mode 100644
index 000000000..69587f15d
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetInstalledCertificateStatusEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Charging Station indicates if it can process the request. */
+public enum GetInstalledCertificateStatusEnum {
+ Accepted,
+ NotFound
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetVariableData.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetVariableData.java
new file mode 100644
index 000000000..b720bac49
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetVariableData.java
@@ -0,0 +1,227 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Class to hold parameters for GetVariables request. */
+public final class GetVariableData {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Attribute type for which value is requested. When absent, default Actual is assumed. */
+ @Nullable private AttributeEnum attributeType;
+
+ /** A physical or logical component */
+ private Component component;
+
+ /** Reference key to a component-variable. */
+ private Variable variable;
+
+ /**
+ * Constructor for the GetVariableData class
+ *
+ * @param component A physical or logical component
+ * @param variable Reference key to a component-variable.
+ */
+ public GetVariableData(Component component, Variable variable) {
+ setComponent(component);
+ setVariable(variable);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetVariableData withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets attribute type for which value is requested. When absent, default Actual is assumed.
+ *
+ * @return Attribute type for which value is requested
+ */
+ public AttributeEnum getAttributeType() {
+ return attributeType != null ? attributeType : AttributeEnum.Actual;
+ }
+
+ /**
+ * Sets attribute type for which value is requested. When absent, default Actual is assumed.
+ *
+ * @param attributeType Attribute type for which value is requested
+ */
+ public void setAttributeType(@Nullable AttributeEnum attributeType) {
+ this.attributeType = attributeType;
+ }
+
+ /**
+ * Adds attribute type for which value is requested. When absent, default Actual is assumed.
+ *
+ * @param attributeType Attribute type for which value is requested
+ * @return this
+ */
+ public GetVariableData withAttributeType(@Nullable AttributeEnum attributeType) {
+ setAttributeType(attributeType);
+ return this;
+ }
+
+ /**
+ * Gets a physical or logical component
+ *
+ * @return A physical or logical component
+ */
+ public Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets a physical or logical component
+ *
+ * @param component A physical or logical component
+ */
+ public void setComponent(Component component) {
+ if (!isValidComponent(component)) {
+ throw new PropertyConstraintException(component, "component is invalid");
+ }
+ this.component = component;
+ }
+
+ /**
+ * Returns whether the given component is valid
+ *
+ * @param component the component to check the validity of
+ * @return {@code true} if component is valid, {@code false} if not
+ */
+ private boolean isValidComponent(Component component) {
+ return component != null && component.validate();
+ }
+
+ /**
+ * Gets reference key to a component-variable.
+ *
+ * @return Reference key to a component-variable
+ */
+ public Variable getVariable() {
+ return variable;
+ }
+
+ /**
+ * Sets reference key to a component-variable.
+ *
+ * @param variable Reference key to a component-variable
+ */
+ public void setVariable(Variable variable) {
+ if (!isValidVariable(variable)) {
+ throw new PropertyConstraintException(variable, "variable is invalid");
+ }
+ this.variable = variable;
+ }
+
+ /**
+ * Returns whether the given variable is valid
+ *
+ * @param variable the variable to check the validity of
+ * @return {@code true} if variable is valid, {@code false} if not
+ */
+ private boolean isValidVariable(Variable variable) {
+ return variable != null && variable.validate();
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidComponent(component)
+ && isValidVariable(variable);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetVariableData that = (GetVariableData) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(attributeType, that.attributeType)
+ && Objects.equals(component, that.component)
+ && Objects.equals(variable, that.variable);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, attributeType, component, variable);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("attributeType", attributeType)
+ .add("component", component)
+ .add("variable", variable)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetVariableResult.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetVariableResult.java
new file mode 100644
index 000000000..6622a2341
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetVariableResult.java
@@ -0,0 +1,386 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Class to hold results of GetVariables request. */
+public final class GetVariableResult {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo attributeStatusInfo;
+
+ /** Result status of getting the variable. */
+ private GetVariableStatusEnum attributeStatus;
+
+ /** Attribute type for which value is requested. When absent, default Actual is assumed. */
+ @Nullable private AttributeEnum attributeType;
+
+ /**
+ * Value of requested attribute type of component-variable. This field can only be empty when the
+ * given status is NOT accepted.
+ *
+ * The Configuration Variable ReportingValueSize can be used to limit
+ * GetVariableResult.attributeValue, VariableAttribute.value and EventData.actualValue. The max
+ * size of these values will always remain equal.
+ */
+ @Nullable private String attributeValue;
+
+ /** A physical or logical component */
+ private Component component;
+
+ /** Reference key to a component-variable. */
+ private Variable variable;
+
+ /**
+ * Constructor for the GetVariableResult class
+ *
+ * @param attributeStatus Result status of getting the variable.
+ * @param component A physical or logical component
+ * @param variable Reference key to a component-variable.
+ */
+ public GetVariableResult(
+ GetVariableStatusEnum attributeStatus, Component component, Variable variable) {
+ setAttributeStatus(attributeStatus);
+ setComponent(component);
+ setVariable(variable);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public GetVariableResult withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getAttributeStatusInfo() {
+ return attributeStatusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param attributeStatusInfo More information about the status
+ */
+ public void setAttributeStatusInfo(@Nullable StatusInfo attributeStatusInfo) {
+ if (!isValidAttributeStatusInfo(attributeStatusInfo)) {
+ throw new PropertyConstraintException(attributeStatusInfo, "attributeStatusInfo is invalid");
+ }
+ this.attributeStatusInfo = attributeStatusInfo;
+ }
+
+ /**
+ * Returns whether the given attributeStatusInfo is valid
+ *
+ * @param attributeStatusInfo the attributeStatusInfo to check the validity of
+ * @return {@code true} if attributeStatusInfo is valid, {@code false} if not
+ */
+ private boolean isValidAttributeStatusInfo(@Nullable StatusInfo attributeStatusInfo) {
+ return attributeStatusInfo == null || attributeStatusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param attributeStatusInfo More information about the status
+ * @return this
+ */
+ public GetVariableResult withAttributeStatusInfo(@Nullable StatusInfo attributeStatusInfo) {
+ setAttributeStatusInfo(attributeStatusInfo);
+ return this;
+ }
+
+ /**
+ * Gets result status of getting the variable.
+ *
+ * @return Result status of getting the variable
+ */
+ public GetVariableStatusEnum getAttributeStatus() {
+ return attributeStatus;
+ }
+
+ /**
+ * Sets result status of getting the variable.
+ *
+ * @param attributeStatus Result status of getting the variable
+ */
+ public void setAttributeStatus(GetVariableStatusEnum attributeStatus) {
+ if (!isValidAttributeStatus(attributeStatus)) {
+ throw new PropertyConstraintException(attributeStatus, "attributeStatus is invalid");
+ }
+ this.attributeStatus = attributeStatus;
+ }
+
+ /**
+ * Returns whether the given attributeStatus is valid
+ *
+ * @param attributeStatus the attributeStatus to check the validity of
+ * @return {@code true} if attributeStatus is valid, {@code false} if not
+ */
+ private boolean isValidAttributeStatus(GetVariableStatusEnum attributeStatus) {
+ return attributeStatus != null;
+ }
+
+ /**
+ * Gets attribute type for which value is requested. When absent, default Actual is assumed.
+ *
+ * @return Attribute type for which value is requested
+ */
+ public AttributeEnum getAttributeType() {
+ return attributeType != null ? attributeType : AttributeEnum.Actual;
+ }
+
+ /**
+ * Sets attribute type for which value is requested. When absent, default Actual is assumed.
+ *
+ * @param attributeType Attribute type for which value is requested
+ */
+ public void setAttributeType(@Nullable AttributeEnum attributeType) {
+ this.attributeType = attributeType;
+ }
+
+ /**
+ * Adds attribute type for which value is requested. When absent, default Actual is assumed.
+ *
+ * @param attributeType Attribute type for which value is requested
+ * @return this
+ */
+ public GetVariableResult withAttributeType(@Nullable AttributeEnum attributeType) {
+ setAttributeType(attributeType);
+ return this;
+ }
+
+ /**
+ * Gets value of requested attribute type of component-variable. This field can only be empty when
+ * the given status is NOT accepted.
+ *
+ * @return Value of requested attribute type of component-variable
+ */
+ @Nullable
+ public String getAttributeValue() {
+ return attributeValue;
+ }
+
+ /**
+ * Sets value of requested attribute type of component-variable. This field can only be empty when
+ * the given status is NOT accepted.
+ *
+ * @param attributeValue Value of requested attribute type of component-variable
+ */
+ public void setAttributeValue(@Nullable String attributeValue) {
+ if (!isValidAttributeValue(attributeValue)) {
+ throw new PropertyConstraintException(attributeValue, "attributeValue is invalid");
+ }
+ this.attributeValue = attributeValue;
+ }
+
+ /**
+ * Returns whether the given attributeValue is valid
+ *
+ * @param attributeValue the attributeValue to check the validity of
+ * @return {@code true} if attributeValue is valid, {@code false} if not
+ */
+ private boolean isValidAttributeValue(@Nullable String attributeValue) {
+ if (attributeStatus != GetVariableStatusEnum.Accepted) {
+ return attributeValue == null || attributeValue.length() <= 2500;
+ } else {
+ return attributeValue != null && attributeValue.length() <= 2500;
+ }
+ }
+
+ /**
+ * Adds value of requested attribute type of component-variable. This field can only be empty when
+ * the given status is NOT accepted.
+ *
+ * @param attributeValue Value of requested attribute type of component-variable
+ * @return this
+ */
+ public GetVariableResult withAttributeValue(@Nullable String attributeValue) {
+ setAttributeValue(attributeValue);
+ return this;
+ }
+
+ /**
+ * Gets a physical or logical component
+ *
+ * @return A physical or logical component
+ */
+ public Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets a physical or logical component
+ *
+ * @param component A physical or logical component
+ */
+ public void setComponent(Component component) {
+ if (!isValidComponent(component)) {
+ throw new PropertyConstraintException(component, "component is invalid");
+ }
+ this.component = component;
+ }
+
+ /**
+ * Returns whether the given component is valid
+ *
+ * @param component the component to check the validity of
+ * @return {@code true} if component is valid, {@code false} if not
+ */
+ private boolean isValidComponent(Component component) {
+ return component != null && component.validate();
+ }
+
+ /**
+ * Gets reference key to a component-variable.
+ *
+ * @return Reference key to a component-variable
+ */
+ public Variable getVariable() {
+ return variable;
+ }
+
+ /**
+ * Sets reference key to a component-variable.
+ *
+ * @param variable Reference key to a component-variable
+ */
+ public void setVariable(Variable variable) {
+ if (!isValidVariable(variable)) {
+ throw new PropertyConstraintException(variable, "variable is invalid");
+ }
+ this.variable = variable;
+ }
+
+ /**
+ * Returns whether the given variable is valid
+ *
+ * @param variable the variable to check the validity of
+ * @return {@code true} if variable is valid, {@code false} if not
+ */
+ private boolean isValidVariable(Variable variable) {
+ return variable != null && variable.validate();
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidAttributeStatusInfo(attributeStatusInfo)
+ && isValidAttributeStatus(attributeStatus)
+ && isValidAttributeValue(attributeValue)
+ && isValidComponent(component)
+ && isValidVariable(variable);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetVariableResult that = (GetVariableResult) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(attributeStatusInfo, that.attributeStatusInfo)
+ && Objects.equals(attributeStatus, that.attributeStatus)
+ && Objects.equals(attributeType, that.attributeType)
+ && Objects.equals(attributeValue, that.attributeValue)
+ && Objects.equals(component, that.component)
+ && Objects.equals(variable, that.variable);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ attributeStatusInfo,
+ attributeStatus,
+ attributeType,
+ attributeValue,
+ component,
+ variable);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("attributeStatusInfo", attributeStatusInfo)
+ .add("attributeStatus", attributeStatus)
+ .add("attributeType", attributeType)
+ .add("attributeValue", attributeValue)
+ .add("component", component)
+ .add("variable", variable)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetVariableStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetVariableStatusEnum.java
new file mode 100644
index 000000000..439bf173e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/GetVariableStatusEnum.java
@@ -0,0 +1,34 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Result status of getting the variable. */
+public enum GetVariableStatusEnum {
+ Accepted,
+ Rejected,
+ UnknownComponent,
+ UnknownVariable,
+ NotSupportedAttributeType
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/HashAlgorithmEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/HashAlgorithmEnum.java
new file mode 100644
index 000000000..033a3021d
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/HashAlgorithmEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Used algorithms for the hashes provided. */
+public enum HashAlgorithmEnum {
+ SHA256,
+ SHA384,
+ SHA512
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/IdToken.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/IdToken.java
new file mode 100644
index 000000000..36d253efe
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/IdToken.java
@@ -0,0 +1,263 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * A case insensitive identifier to use for the authorization and the type of authorization to
+ * support multiple forms of identifiers.
+ */
+public final class IdToken {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * A case insensitive identifier to use for the authorization and the type of authorization to
+ * support multiple forms of identifiers.
+ */
+ @Nullable private AdditionalInfo[] additionalInfo;
+
+ /**
+ * IdToken is case insensitive. Might hold the hidden id of an RFID tag, but can for example also
+ * contain a UUID.
+ */
+ private String idToken;
+
+ /** Enumeration of possible idToken types. */
+ private IdTokenEnum type;
+
+ /**
+ * Constructor for the IdToken class
+ *
+ * @param idToken IdToken is case insensitive. Might hold the hidden id of an RFID tag, but can
+ * for example also contain a UUID.
+ * @param type Enumeration of possible idToken types.
+ */
+ public IdToken(String idToken, IdTokenEnum type) {
+ setIdToken(idToken);
+ setType(type);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public IdToken withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @return A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ @Nullable
+ public AdditionalInfo[] getAdditionalInfo() {
+ return additionalInfo;
+ }
+
+ /**
+ * Sets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param additionalInfo A case insensitive identifier to use for the authorization and the type
+ * of authorization to support multiple forms of identifiers
+ */
+ public void setAdditionalInfo(@Nullable AdditionalInfo[] additionalInfo) {
+ if (!isValidAdditionalInfo(additionalInfo)) {
+ throw new PropertyConstraintException(additionalInfo, "additionalInfo is invalid");
+ }
+ this.additionalInfo = additionalInfo;
+ }
+
+ /**
+ * Returns whether the given additionalInfo is valid
+ *
+ * @param additionalInfo the additionalInfo to check the validity of
+ * @return {@code true} if additionalInfo is valid, {@code false} if not
+ */
+ private boolean isValidAdditionalInfo(@Nullable AdditionalInfo[] additionalInfo) {
+ return additionalInfo == null
+ || (additionalInfo.length >= 1
+ && Arrays.stream(additionalInfo).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param additionalInfo A case insensitive identifier to use for the authorization and the type
+ * of authorization to support multiple forms of identifiers
+ * @return this
+ */
+ public IdToken withAdditionalInfo(@Nullable AdditionalInfo[] additionalInfo) {
+ setAdditionalInfo(additionalInfo);
+ return this;
+ }
+
+ /**
+ * Gets idToken is case insensitive. Might hold the hidden id of an RFID tag, but can for example
+ * also contain a UUID.
+ *
+ * @return IdToken is case insensitive
+ */
+ public String getIdToken() {
+ return idToken;
+ }
+
+ /**
+ * Sets idToken is case insensitive. Might hold the hidden id of an RFID tag, but can for example
+ * also contain a UUID.
+ *
+ * @param idToken IdToken is case insensitive
+ */
+ public void setIdToken(String idToken) {
+ if (!isValidIdToken(idToken)) {
+ throw new PropertyConstraintException(idToken, "idToken is invalid");
+ }
+ this.idToken = idToken;
+ }
+
+ /**
+ * Returns whether the given idToken is valid
+ *
+ * @param idToken the idToken to check the validity of
+ * @return {@code true} if idToken is valid, {@code false} if not
+ */
+ private boolean isValidIdToken(String idToken) {
+ return idToken != null && idToken.length() <= 36;
+ }
+
+ /**
+ * Gets enumeration of possible idToken types.
+ *
+ * @return Enumeration of possible idToken types
+ */
+ public IdTokenEnum getType() {
+ return type;
+ }
+
+ /**
+ * Sets enumeration of possible idToken types.
+ *
+ * @param type Enumeration of possible idToken types
+ */
+ public void setType(IdTokenEnum type) {
+ if (!isValidType(type)) {
+ throw new PropertyConstraintException(type, "type is invalid");
+ }
+ this.type = type;
+ }
+
+ /**
+ * Returns whether the given type is valid
+ *
+ * @param type the type to check the validity of
+ * @return {@code true} if type is valid, {@code false} if not
+ */
+ private boolean isValidType(IdTokenEnum type) {
+ return type != null;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidAdditionalInfo(additionalInfo)
+ && isValidIdToken(idToken)
+ && isValidType(type);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ IdToken that = (IdToken) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(additionalInfo, that.additionalInfo)
+ && Objects.equals(idToken, that.idToken)
+ && Objects.equals(type, that.type);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(additionalInfo), idToken, type);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("additionalInfo", additionalInfo)
+ .add("idToken", idToken)
+ .add("type", type)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/IdTokenEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/IdTokenEnum.java
new file mode 100644
index 000000000..36a227172
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/IdTokenEnum.java
@@ -0,0 +1,37 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Enumeration of possible idToken types. */
+public enum IdTokenEnum {
+ Central,
+ eMAID,
+ ISO14443,
+ ISO15693,
+ KeyCode,
+ Local,
+ MacAddress,
+ NoAuthorization
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/IdTokenInfo.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/IdTokenInfo.java
new file mode 100644
index 000000000..cb8f4b39b
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/IdTokenInfo.java
@@ -0,0 +1,542 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.time.ZonedDateTime;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * ID Token
+ *
+ * Status information about an identifier. It is advised to not stop charging for a token that
+ * expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is not
+ * given, the status has no end date.
+ */
+public final class IdTokenInfo {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * ID Token. Status. Authorization Status
+ *
+ * Current status of the ID Token.
+ */
+ private AuthorizationStatusEnum status;
+
+ /**
+ * ID Token. Expiry. Date Time
+ *
+ * Date and Time after which the token must be considered invalid.
+ */
+ @Nullable private ZonedDateTime cacheExpiryDateTime;
+
+ /**
+ * Priority from a business point of view. Default priority is 0, The range is from -9 to 9.
+ * Higher values indicate a higher priority. The chargingPriority in TransactionEventResponse
+ * overrules this one.
+ */
+ @Nullable private Integer chargingPriority;
+
+ /**
+ * ID Token. Language1. Language Code
+ *
+ * Preferred user interface language of identifier user. Contains a language code as defined in
+ * [RFC5646].
+ */
+ @Nullable private String language1;
+
+ /**
+ * Only used when the IdToken is only valid for one or more specific EVSEs, not for the entire
+ * Charging Station.
+ */
+ @Nullable private Integer[] evseId;
+
+ /**
+ * A case insensitive identifier to use for the authorization and the type of authorization to
+ * support multiple forms of identifiers.
+ */
+ @Nullable private IdToken groupIdToken;
+
+ /**
+ * ID Token. Language2. Language Code
+ *
+ * Second preferred user interface language of identifier user. Donât use when language1 is
+ * omitted, has to be different from language1. Contains a language code as defined in [RFC5646].
+ */
+ @Nullable private String language2;
+
+ /**
+ * Message Content
+ *
+ * Message details, for a message to be displayed on a Charging Station.
+ */
+ @Nullable private MessageContent personalMessage;
+
+ /**
+ * Constructor for the IdTokenInfo class
+ *
+ * @param status Current status of the ID Token.
+ */
+ public IdTokenInfo(AuthorizationStatusEnum status) {
+ setStatus(status);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public IdTokenInfo withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets current status of the ID Token.
+ *
+ * @return Current status of the ID Token
+ */
+ public AuthorizationStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets current status of the ID Token.
+ *
+ * @param status Current status of the ID Token
+ */
+ public void setStatus(AuthorizationStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(AuthorizationStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets date and Time after which the token must be considered invalid.
+ *
+ * @return Date and Time after which the token must be considered invalid
+ */
+ @Nullable
+ public ZonedDateTime getCacheExpiryDateTime() {
+ return cacheExpiryDateTime;
+ }
+
+ /**
+ * Sets date and Time after which the token must be considered invalid.
+ *
+ * @param cacheExpiryDateTime Date and Time after which the token must be considered invalid
+ */
+ public void setCacheExpiryDateTime(@Nullable ZonedDateTime cacheExpiryDateTime) {
+ this.cacheExpiryDateTime = cacheExpiryDateTime;
+ }
+
+ /**
+ * Adds date and Time after which the token must be considered invalid.
+ *
+ * @param cacheExpiryDateTime Date and Time after which the token must be considered invalid
+ * @return this
+ */
+ public IdTokenInfo withCacheExpiryDateTime(@Nullable ZonedDateTime cacheExpiryDateTime) {
+ setCacheExpiryDateTime(cacheExpiryDateTime);
+ return this;
+ }
+
+ /**
+ * Gets priority from a business point of view. Default priority is 0, The range is from -9 to 9.
+ * Higher values indicate a higher priority. The chargingPriority in TransactionEventResponse
+ * overrules this one.
+ *
+ * @return Priority from a business point of view
+ */
+ @Nullable
+ public Integer getChargingPriority() {
+ return chargingPriority;
+ }
+
+ /**
+ * Sets priority from a business point of view. Default priority is 0, The range is from -9 to 9.
+ * Higher values indicate a higher priority. The chargingPriority in TransactionEventResponse
+ * overrules this one.
+ *
+ * @param chargingPriority Priority from a business point of view
+ */
+ public void setChargingPriority(@Nullable Integer chargingPriority) {
+ this.chargingPriority = chargingPriority;
+ }
+
+ /**
+ * Adds priority from a business point of view. Default priority is 0, The range is from -9 to 9.
+ * Higher values indicate a higher priority. The chargingPriority in TransactionEventResponse
+ * overrules this one.
+ *
+ * @param chargingPriority Priority from a business point of view
+ * @return this
+ */
+ public IdTokenInfo withChargingPriority(@Nullable Integer chargingPriority) {
+ setChargingPriority(chargingPriority);
+ return this;
+ }
+
+ /**
+ * Gets preferred user interface language of identifier user. Contains a language code as defined
+ * in [RFC5646].
+ *
+ * @return Preferred user interface language of identifier user
+ */
+ @Nullable
+ public String getLanguage1() {
+ return language1;
+ }
+
+ /**
+ * Sets preferred user interface language of identifier user. Contains a language code as defined
+ * in [RFC5646].
+ *
+ * @param language1 Preferred user interface language of identifier user
+ */
+ public void setLanguage1(@Nullable String language1) {
+ if (!isValidLanguage1(language1)) {
+ throw new PropertyConstraintException(language1, "language1 is invalid");
+ }
+ this.language1 = language1;
+ }
+
+ /**
+ * Returns whether the given language1 is valid
+ *
+ * @param language1 the language1 to check the validity of
+ * @return {@code true} if language1 is valid, {@code false} if not
+ */
+ private boolean isValidLanguage1(@Nullable String language1) {
+ return language1 == null || language1.length() <= 8;
+ }
+
+ /**
+ * Adds preferred user interface language of identifier user. Contains a language code as defined
+ * in [RFC5646].
+ *
+ * @param language1 Preferred user interface language of identifier user
+ * @return this
+ */
+ public IdTokenInfo withLanguage1(@Nullable String language1) {
+ setLanguage1(language1);
+ return this;
+ }
+
+ /**
+ * Gets only used when the IdToken is only valid for one or more specific EVSEs, not for the
+ * entire Charging Station.
+ *
+ * @return Only used when the IdToken is only valid for one or more specific EVSEs, not for the
+ * entire Charging Station
+ */
+ @Nullable
+ public Integer[] getEvseId() {
+ return evseId;
+ }
+
+ /**
+ * Sets only used when the IdToken is only valid for one or more specific EVSEs, not for the
+ * entire Charging Station.
+ *
+ * @param evseId Only used when the IdToken is only valid for one or more specific EVSEs, not for
+ * the entire Charging Station
+ */
+ public void setEvseId(@Nullable Integer[] evseId) {
+ if (!isValidEvseId(evseId)) {
+ throw new PropertyConstraintException(evseId, "evseId is invalid");
+ }
+ this.evseId = evseId;
+ }
+
+ /**
+ * Returns whether the given evseId is valid
+ *
+ * @param evseId the evseId to check the validity of
+ * @return {@code true} if evseId is valid, {@code false} if not
+ */
+ private boolean isValidEvseId(@Nullable Integer[] evseId) {
+ return evseId == null || (evseId.length >= 1);
+ }
+
+ /**
+ * Adds only used when the IdToken is only valid for one or more specific EVSEs, not for the
+ * entire Charging Station.
+ *
+ * @param evseId Only used when the IdToken is only valid for one or more specific EVSEs, not for
+ * the entire Charging Station
+ * @return this
+ */
+ public IdTokenInfo withEvseId(@Nullable Integer[] evseId) {
+ setEvseId(evseId);
+ return this;
+ }
+
+ /**
+ * Gets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @return A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ @Nullable
+ public IdToken getGroupIdToken() {
+ return groupIdToken;
+ }
+
+ /**
+ * Sets a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param groupIdToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ */
+ public void setGroupIdToken(@Nullable IdToken groupIdToken) {
+ if (!isValidGroupIdToken(groupIdToken)) {
+ throw new PropertyConstraintException(groupIdToken, "groupIdToken is invalid");
+ }
+ this.groupIdToken = groupIdToken;
+ }
+
+ /**
+ * Returns whether the given groupIdToken is valid
+ *
+ * @param groupIdToken the groupIdToken to check the validity of
+ * @return {@code true} if groupIdToken is valid, {@code false} if not
+ */
+ private boolean isValidGroupIdToken(@Nullable IdToken groupIdToken) {
+ return groupIdToken == null || groupIdToken.validate();
+ }
+
+ /**
+ * Adds a case insensitive identifier to use for the authorization and the type of authorization
+ * to support multiple forms of identifiers.
+ *
+ * @param groupIdToken A case insensitive identifier to use for the authorization and the type of
+ * authorization to support multiple forms of identifiers
+ * @return this
+ */
+ public IdTokenInfo withGroupIdToken(@Nullable IdToken groupIdToken) {
+ setGroupIdToken(groupIdToken);
+ return this;
+ }
+
+ /**
+ * Gets second preferred user interface language of identifier user. Donât use when language1 is
+ * omitted, has to be different from language1. Contains a language code as defined in [RFC5646].
+ *
+ * @return Second preferred user interface language of identifier user
+ */
+ @Nullable
+ public String getLanguage2() {
+ return language2;
+ }
+
+ /**
+ * Sets second preferred user interface language of identifier user. Donât use when language1 is
+ * omitted, has to be different from language1. Contains a language code as defined in [RFC5646].
+ *
+ * @param language2 Second preferred user interface language of identifier user
+ */
+ public void setLanguage2(@Nullable String language2) {
+ if (!isValidLanguage2(language2)) {
+ throw new PropertyConstraintException(language2, "language2 is invalid");
+ }
+ this.language2 = language2;
+ }
+
+ /**
+ * Returns whether the given language2 is valid
+ *
+ * @param language2 the language2 to check the validity of
+ * @return {@code true} if language2 is valid, {@code false} if not
+ */
+ private boolean isValidLanguage2(@Nullable String language2) {
+ return language2 == null || language2.length() <= 8;
+ }
+
+ /**
+ * Adds second preferred user interface language of identifier user. Donât use when language1 is
+ * omitted, has to be different from language1. Contains a language code as defined in [RFC5646].
+ *
+ * @param language2 Second preferred user interface language of identifier user
+ * @return this
+ */
+ public IdTokenInfo withLanguage2(@Nullable String language2) {
+ setLanguage2(language2);
+ return this;
+ }
+
+ /**
+ * Gets message details, for a message to be displayed on a Charging Station.
+ *
+ * @return Message details, for a message to be displayed on a Charging Station
+ */
+ @Nullable
+ public MessageContent getPersonalMessage() {
+ return personalMessage;
+ }
+
+ /**
+ * Sets message details, for a message to be displayed on a Charging Station.
+ *
+ * @param personalMessage Message details, for a message to be displayed on a Charging Station
+ */
+ public void setPersonalMessage(@Nullable MessageContent personalMessage) {
+ if (!isValidPersonalMessage(personalMessage)) {
+ throw new PropertyConstraintException(personalMessage, "personalMessage is invalid");
+ }
+ this.personalMessage = personalMessage;
+ }
+
+ /**
+ * Returns whether the given personalMessage is valid
+ *
+ * @param personalMessage the personalMessage to check the validity of
+ * @return {@code true} if personalMessage is valid, {@code false} if not
+ */
+ private boolean isValidPersonalMessage(@Nullable MessageContent personalMessage) {
+ return personalMessage == null || personalMessage.validate();
+ }
+
+ /**
+ * Adds message details, for a message to be displayed on a Charging Station.
+ *
+ * @param personalMessage Message details, for a message to be displayed on a Charging Station
+ * @return this
+ */
+ public IdTokenInfo withPersonalMessage(@Nullable MessageContent personalMessage) {
+ setPersonalMessage(personalMessage);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidStatus(status)
+ && isValidLanguage1(language1)
+ && isValidEvseId(evseId)
+ && isValidGroupIdToken(groupIdToken)
+ && isValidLanguage2(language2)
+ && isValidPersonalMessage(personalMessage);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ IdTokenInfo that = (IdTokenInfo) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(status, that.status)
+ && Objects.equals(cacheExpiryDateTime, that.cacheExpiryDateTime)
+ && Objects.equals(chargingPriority, that.chargingPriority)
+ && Objects.equals(language1, that.language1)
+ && Arrays.equals(evseId, that.evseId)
+ && Objects.equals(groupIdToken, that.groupIdToken)
+ && Objects.equals(language2, that.language2)
+ && Objects.equals(personalMessage, that.personalMessage);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ status,
+ cacheExpiryDateTime,
+ chargingPriority,
+ language1,
+ Arrays.hashCode(evseId),
+ groupIdToken,
+ language2,
+ personalMessage);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("status", status)
+ .add("cacheExpiryDateTime", cacheExpiryDateTime)
+ .add("chargingPriority", chargingPriority)
+ .add("language1", language1)
+ .add("evseId", evseId)
+ .add("groupIdToken", groupIdToken)
+ .add("language2", language2)
+ .add("personalMessage", personalMessage)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/InstallCertificateStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/InstallCertificateStatusEnum.java
new file mode 100644
index 000000000..4b9386f85
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/InstallCertificateStatusEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Charging Station indicates if installation was successful. */
+public enum InstallCertificateStatusEnum {
+ Accepted,
+ Rejected,
+ Failed
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/InstallCertificateUseEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/InstallCertificateUseEnum.java
new file mode 100644
index 000000000..239259d2e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/InstallCertificateUseEnum.java
@@ -0,0 +1,33 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The certificate type that is sent. */
+public enum InstallCertificateUseEnum {
+ V2GRootCertificate,
+ MORootCertificate,
+ CSMSRootCertificate,
+ ManufacturerRootCertificate
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Iso15118EVCertificateStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Iso15118EVCertificateStatusEnum.java
new file mode 100644
index 000000000..30e39eb4c
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Iso15118EVCertificateStatusEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether the message was processed properly. */
+public enum Iso15118EVCertificateStatusEnum {
+ Accepted,
+ Failed
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/LocationEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/LocationEnum.java
new file mode 100644
index 000000000..3faebf142
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/LocationEnum.java
@@ -0,0 +1,38 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Sampled Value. Location. Location Code
+ *
+ * Where the measured value has been sampled. Default = "Outlet"
+ */
+public enum LocationEnum {
+ Body,
+ Cable,
+ EV,
+ Inlet,
+ Outlet
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/LogEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/LogEnum.java
new file mode 100644
index 000000000..07f363dad
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/LogEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The type of log file that the Charging Station should send. */
+public enum LogEnum {
+ DiagnosticsLog,
+ SecurityLog
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/LogParameters.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/LogParameters.java
new file mode 100644
index 000000000..4d71634e8
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/LogParameters.java
@@ -0,0 +1,246 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Log
+ *
+ * Generic class for the configuration of logging entries.
+ */
+public final class LogParameters {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Log. Remote Location. URI
+ *
+ * The URL of the location at the remote system where the log should be stored.
+ */
+ private String remoteLocation;
+
+ /**
+ * Log. Oldest Timestamp. Date Time
+ *
+ * The date and time of the oldest logging information to include in the diagnostics.
+ */
+ @Nullable private ZonedDateTime oldestTimestamp;
+
+ /**
+ * Log. Latest Timestamp. Date Time
+ *
+ * The date and time of the latest logging information to include in the diagnostics.
+ */
+ @Nullable private ZonedDateTime latestTimestamp;
+
+ /**
+ * Constructor for the LogParameters class
+ *
+ * @param remoteLocation The URL of the location at the remote system where the log should be
+ * stored.
+ */
+ public LogParameters(String remoteLocation) {
+ setRemoteLocation(remoteLocation);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public LogParameters withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the URL of the location at the remote system where the log should be stored.
+ *
+ * @return The URL of the location at the remote system where the log should be stored
+ */
+ public String getRemoteLocation() {
+ return remoteLocation;
+ }
+
+ /**
+ * Sets the URL of the location at the remote system where the log should be stored.
+ *
+ * @param remoteLocation The URL of the location at the remote system where the log should be
+ * stored
+ */
+ public void setRemoteLocation(String remoteLocation) {
+ if (!isValidRemoteLocation(remoteLocation)) {
+ throw new PropertyConstraintException(remoteLocation, "remoteLocation is invalid");
+ }
+ this.remoteLocation = remoteLocation;
+ }
+
+ /**
+ * Returns whether the given remoteLocation is valid
+ *
+ * @param remoteLocation the remoteLocation to check the validity of
+ * @return {@code true} if remoteLocation is valid, {@code false} if not
+ */
+ private boolean isValidRemoteLocation(String remoteLocation) {
+ return remoteLocation != null && remoteLocation.length() <= 512;
+ }
+
+ /**
+ * Gets the date and time of the oldest logging information to include in the diagnostics.
+ *
+ * @return The date and time of the oldest logging information to include in the diagnostics
+ */
+ @Nullable
+ public ZonedDateTime getOldestTimestamp() {
+ return oldestTimestamp;
+ }
+
+ /**
+ * Sets the date and time of the oldest logging information to include in the diagnostics.
+ *
+ * @param oldestTimestamp The date and time of the oldest logging information to include in the
+ * diagnostics
+ */
+ public void setOldestTimestamp(@Nullable ZonedDateTime oldestTimestamp) {
+ this.oldestTimestamp = oldestTimestamp;
+ }
+
+ /**
+ * Adds the date and time of the oldest logging information to include in the diagnostics.
+ *
+ * @param oldestTimestamp The date and time of the oldest logging information to include in the
+ * diagnostics
+ * @return this
+ */
+ public LogParameters withOldestTimestamp(@Nullable ZonedDateTime oldestTimestamp) {
+ setOldestTimestamp(oldestTimestamp);
+ return this;
+ }
+
+ /**
+ * Gets the date and time of the latest logging information to include in the diagnostics.
+ *
+ * @return The date and time of the latest logging information to include in the diagnostics
+ */
+ @Nullable
+ public ZonedDateTime getLatestTimestamp() {
+ return latestTimestamp;
+ }
+
+ /**
+ * Sets the date and time of the latest logging information to include in the diagnostics.
+ *
+ * @param latestTimestamp The date and time of the latest logging information to include in the
+ * diagnostics
+ */
+ public void setLatestTimestamp(@Nullable ZonedDateTime latestTimestamp) {
+ this.latestTimestamp = latestTimestamp;
+ }
+
+ /**
+ * Adds the date and time of the latest logging information to include in the diagnostics.
+ *
+ * @param latestTimestamp The date and time of the latest logging information to include in the
+ * diagnostics
+ * @return this
+ */
+ public LogParameters withLatestTimestamp(@Nullable ZonedDateTime latestTimestamp) {
+ setLatestTimestamp(latestTimestamp);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidRemoteLocation(remoteLocation);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ LogParameters that = (LogParameters) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(remoteLocation, that.remoteLocation)
+ && Objects.equals(oldestTimestamp, that.oldestTimestamp)
+ && Objects.equals(latestTimestamp, that.latestTimestamp);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, remoteLocation, oldestTimestamp, latestTimestamp);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("remoteLocation", remoteLocation)
+ .add("oldestTimestamp", oldestTimestamp)
+ .add("latestTimestamp", latestTimestamp)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/LogStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/LogStatusEnum.java
new file mode 100644
index 000000000..db4f1d2e1
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/LogStatusEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** This field indicates whether the Charging Station was able to accept the request. */
+public enum LogStatusEnum {
+ Accepted,
+ Rejected,
+ AcceptedCanceled
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MeasurandEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MeasurandEnum.java
new file mode 100644
index 000000000..107b56c62
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MeasurandEnum.java
@@ -0,0 +1,82 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Sampled Value. Measurand. Measurand Code
+ *
+ * Type of measurement. Default = "Energy.Active.Import.Register"
+ */
+public enum MeasurandEnum {
+ @SerializedName("Current.Export")
+ CurrentExport,
+ @SerializedName("Current.Import")
+ CurrentImport,
+ @SerializedName("Current.Offered")
+ CurrentOffered,
+ @SerializedName("Energy.Active.Export.Register")
+ EnergyActiveExportRegister,
+ @SerializedName("Energy.Active.Import.Register")
+ EnergyActiveImportRegister,
+ @SerializedName("Energy.Reactive.Export.Register")
+ EnergyReactiveExportRegister,
+ @SerializedName("Energy.Reactive.Import.Register")
+ EnergyReactiveImportRegister,
+ @SerializedName("Energy.Active.Export.Interval")
+ EnergyActiveExportInterval,
+ @SerializedName("Energy.Active.Import.Interval")
+ EnergyActiveImportInterval,
+ @SerializedName("Energy.Active.Net")
+ EnergyActiveNet,
+ @SerializedName("Energy.Reactive.Export.Interval")
+ EnergyReactiveExportInterval,
+ @SerializedName("Energy.Reactive.Import.Interval")
+ EnergyReactiveImportInterval,
+ @SerializedName("Energy.Reactive.Net")
+ EnergyReactiveNet,
+ @SerializedName("Energy.Apparent.Net")
+ EnergyApparentNet,
+ @SerializedName("Energy.Apparent.Import")
+ EnergyApparentImport,
+ @SerializedName("Energy.Apparent.Export")
+ EnergyApparentExport,
+ Frequency,
+ @SerializedName("Power.Active.Export")
+ PowerActiveExport,
+ @SerializedName("Power.Active.Import")
+ PowerActiveImport,
+ @SerializedName("Power.Factor")
+ PowerFactor,
+ @SerializedName("Power.Offered")
+ PowerOffered,
+ @SerializedName("Power.Reactive.Export")
+ PowerReactiveExport,
+ @SerializedName("Power.Reactive.Import")
+ PowerReactiveImport,
+ SoC,
+ Voltage
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageContent.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageContent.java
new file mode 100644
index 000000000..551839f75
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageContent.java
@@ -0,0 +1,258 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Message Content
+ *
+ * Message details, for a message to be displayed on a Charging Station.
+ */
+public final class MessageContent {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Message Content. Format. Message Format Code
+ *
+ * Format of the message.
+ */
+ private MessageFormatEnum format;
+
+ /**
+ * Message Content. Language. Language Code
+ *
+ * Message language identifier. Contains a language code as defined in [RFC5646].
+ */
+ @Nullable private String language;
+
+ /**
+ * Message Content. Content. Message
+ *
+ * Message contents.
+ */
+ private String content;
+
+ /**
+ * Constructor for the MessageContent class
+ *
+ * @param format Format of the message.
+ * @param content Message contents.
+ */
+ public MessageContent(MessageFormatEnum format, String content) {
+ setFormat(format);
+ setContent(content);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public MessageContent withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets format of the message.
+ *
+ * @return Format of the message
+ */
+ public MessageFormatEnum getFormat() {
+ return format;
+ }
+
+ /**
+ * Sets format of the message.
+ *
+ * @param format Format of the message
+ */
+ public void setFormat(MessageFormatEnum format) {
+ if (!isValidFormat(format)) {
+ throw new PropertyConstraintException(format, "format is invalid");
+ }
+ this.format = format;
+ }
+
+ /**
+ * Returns whether the given format is valid
+ *
+ * @param format the format to check the validity of
+ * @return {@code true} if format is valid, {@code false} if not
+ */
+ private boolean isValidFormat(MessageFormatEnum format) {
+ return format != null;
+ }
+
+ /**
+ * Gets message language identifier. Contains a language code as defined in [RFC5646].
+ *
+ * @return Message language identifier
+ */
+ @Nullable
+ public String getLanguage() {
+ return language;
+ }
+
+ /**
+ * Sets message language identifier. Contains a language code as defined in [RFC5646].
+ *
+ * @param language Message language identifier
+ */
+ public void setLanguage(@Nullable String language) {
+ if (!isValidLanguage(language)) {
+ throw new PropertyConstraintException(language, "language is invalid");
+ }
+ this.language = language;
+ }
+
+ /**
+ * Returns whether the given language is valid
+ *
+ * @param language the language to check the validity of
+ * @return {@code true} if language is valid, {@code false} if not
+ */
+ private boolean isValidLanguage(@Nullable String language) {
+ return language == null || language.length() <= 8;
+ }
+
+ /**
+ * Adds message language identifier. Contains a language code as defined in [RFC5646].
+ *
+ * @param language Message language identifier
+ * @return this
+ */
+ public MessageContent withLanguage(@Nullable String language) {
+ setLanguage(language);
+ return this;
+ }
+
+ /**
+ * Gets message contents.
+ *
+ * @return Message contents
+ */
+ public String getContent() {
+ return content;
+ }
+
+ /**
+ * Sets message contents.
+ *
+ * @param content Message contents
+ */
+ public void setContent(String content) {
+ if (!isValidContent(content)) {
+ throw new PropertyConstraintException(content, "content is invalid");
+ }
+ this.content = content;
+ }
+
+ /**
+ * Returns whether the given content is valid
+ *
+ * @param content the content to check the validity of
+ * @return {@code true} if content is valid, {@code false} if not
+ */
+ private boolean isValidContent(String content) {
+ return content != null && content.length() <= 512;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidFormat(format)
+ && isValidLanguage(language)
+ && isValidContent(content);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ MessageContent that = (MessageContent) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(format, that.format)
+ && Objects.equals(language, that.language)
+ && Objects.equals(content, that.content);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, format, language, content);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("format", format)
+ .add("language", language)
+ .add("content", content)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageFormatEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageFormatEnum.java
new file mode 100644
index 000000000..5129043bb
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageFormatEnum.java
@@ -0,0 +1,37 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Message Content. Format. Message Format Code
+ *
+ * Format of the message.
+ */
+public enum MessageFormatEnum {
+ ASCII,
+ HTML,
+ URI,
+ UTF8
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageInfo.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageInfo.java
new file mode 100644
index 000000000..48ab639e9
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageInfo.java
@@ -0,0 +1,494 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.time.ZonedDateTime;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Message Info
+ *
+ * Message details, for a message to be displayed on a Charging Station.
+ */
+public final class MessageInfo {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** A physical or logical component */
+ @Nullable private Component display;
+
+ /**
+ * Identified Object. MRID. Numeric Identifier
+ *
+ * Master resource identifier, unique within an exchange context. It is defined within the OCPP
+ * context as a positive Integer value (greater or equal to zero).
+ */
+ private Integer id;
+
+ /**
+ * Message Info. Priority. Message Priority Code
+ *
+ * With what priority should this message be shown
+ */
+ private MessagePriorityEnum priority;
+
+ /**
+ * Message Info. State. Message State Code
+ *
+ * During what state should this message be shown. When omitted this message should be shown in
+ * any state of the Charging Station.
+ */
+ @Nullable private MessageStateEnum state;
+
+ /**
+ * Message Info. Start. Date Time
+ *
+ * From what date-time should this message be shown. If omitted: directly.
+ */
+ @Nullable private ZonedDateTime startDateTime;
+
+ /**
+ * Message Info. End. Date Time
+ *
+ * Until what date-time should this message be shown, after this date/time this message SHALL
+ * be removed.
+ */
+ @Nullable private ZonedDateTime endDateTime;
+
+ /**
+ * During which transaction shall this message be shown. Message SHALL be removed by the Charging
+ * Station after transaction has ended.
+ */
+ @Nullable private String transactionId;
+
+ /**
+ * Message Content
+ *
+ * Message details, for a message to be displayed on a Charging Station.
+ */
+ private MessageContent message;
+
+ /**
+ * Constructor for the MessageInfo class
+ *
+ * @param id Master resource identifier, unique within an exchange context. It is defined within
+ * the OCPP context as a positive Integer value (greater or equal to zero).
+ * @param priority With what priority should this message be shown
+ * @param message Message details, for a message to be displayed on a Charging Station.
+ */
+ public MessageInfo(Integer id, MessagePriorityEnum priority, MessageContent message) {
+ setId(id);
+ setPriority(priority);
+ setMessage(message);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public MessageInfo withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets a physical or logical component
+ *
+ * @return A physical or logical component
+ */
+ @Nullable
+ public Component getDisplay() {
+ return display;
+ }
+
+ /**
+ * Sets a physical or logical component
+ *
+ * @param display A physical or logical component
+ */
+ public void setDisplay(@Nullable Component display) {
+ if (!isValidDisplay(display)) {
+ throw new PropertyConstraintException(display, "display is invalid");
+ }
+ this.display = display;
+ }
+
+ /**
+ * Returns whether the given display is valid
+ *
+ * @param display the display to check the validity of
+ * @return {@code true} if display is valid, {@code false} if not
+ */
+ private boolean isValidDisplay(@Nullable Component display) {
+ return display == null || display.validate();
+ }
+
+ /**
+ * Adds a physical or logical component
+ *
+ * @param display A physical or logical component
+ * @return this
+ */
+ public MessageInfo withDisplay(@Nullable Component display) {
+ setDisplay(display);
+ return this;
+ }
+
+ /**
+ * Gets master resource identifier, unique within an exchange context. It is defined within the
+ * OCPP context as a positive Integer value (greater or equal to zero).
+ *
+ * @return Master resource identifier, unique within an exchange context
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * Sets master resource identifier, unique within an exchange context. It is defined within the
+ * OCPP context as a positive Integer value (greater or equal to zero).
+ *
+ * @param id Master resource identifier, unique within an exchange context
+ */
+ public void setId(Integer id) {
+ if (!isValidId(id)) {
+ throw new PropertyConstraintException(id, "id is invalid");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Returns whether the given id is valid
+ *
+ * @param id the id to check the validity of
+ * @return {@code true} if id is valid, {@code false} if not
+ */
+ private boolean isValidId(Integer id) {
+ return id != null;
+ }
+
+ /**
+ * Gets with what priority should this message be shown
+ *
+ * @return With what priority should this message be shown
+ */
+ public MessagePriorityEnum getPriority() {
+ return priority;
+ }
+
+ /**
+ * Sets with what priority should this message be shown
+ *
+ * @param priority With what priority should this message be shown
+ */
+ public void setPriority(MessagePriorityEnum priority) {
+ if (!isValidPriority(priority)) {
+ throw new PropertyConstraintException(priority, "priority is invalid");
+ }
+ this.priority = priority;
+ }
+
+ /**
+ * Returns whether the given priority is valid
+ *
+ * @param priority the priority to check the validity of
+ * @return {@code true} if priority is valid, {@code false} if not
+ */
+ private boolean isValidPriority(MessagePriorityEnum priority) {
+ return priority != null;
+ }
+
+ /**
+ * Gets during what state should this message be shown. When omitted this message should be shown
+ * in any state of the Charging Station.
+ *
+ * @return During what state should this message be shown
+ */
+ @Nullable
+ public MessageStateEnum getState() {
+ return state;
+ }
+
+ /**
+ * Sets during what state should this message be shown. When omitted this message should be shown
+ * in any state of the Charging Station.
+ *
+ * @param state During what state should this message be shown
+ */
+ public void setState(@Nullable MessageStateEnum state) {
+ this.state = state;
+ }
+
+ /**
+ * Adds during what state should this message be shown. When omitted this message should be shown
+ * in any state of the Charging Station.
+ *
+ * @param state During what state should this message be shown
+ * @return this
+ */
+ public MessageInfo withState(@Nullable MessageStateEnum state) {
+ setState(state);
+ return this;
+ }
+
+ /**
+ * Gets from what date-time should this message be shown. If omitted: directly.
+ *
+ * @return From what date-time should this message be shown
+ */
+ @Nullable
+ public ZonedDateTime getStartDateTime() {
+ return startDateTime;
+ }
+
+ /**
+ * Sets from what date-time should this message be shown. If omitted: directly.
+ *
+ * @param startDateTime From what date-time should this message be shown
+ */
+ public void setStartDateTime(@Nullable ZonedDateTime startDateTime) {
+ this.startDateTime = startDateTime;
+ }
+
+ /**
+ * Adds from what date-time should this message be shown. If omitted: directly.
+ *
+ * @param startDateTime From what date-time should this message be shown
+ * @return this
+ */
+ public MessageInfo withStartDateTime(@Nullable ZonedDateTime startDateTime) {
+ setStartDateTime(startDateTime);
+ return this;
+ }
+
+ /**
+ * Gets until what date-time should this message be shown, after this date/time this message SHALL
+ * be removed.
+ *
+ * @return Until what date-time should this message be shown, after this date/time this message
+ * SHALL be removed
+ */
+ @Nullable
+ public ZonedDateTime getEndDateTime() {
+ return endDateTime;
+ }
+
+ /**
+ * Sets until what date-time should this message be shown, after this date/time this message SHALL
+ * be removed.
+ *
+ * @param endDateTime Until what date-time should this message be shown, after this date/time this
+ * message SHALL be removed
+ */
+ public void setEndDateTime(@Nullable ZonedDateTime endDateTime) {
+ this.endDateTime = endDateTime;
+ }
+
+ /**
+ * Adds until what date-time should this message be shown, after this date/time this message SHALL
+ * be removed.
+ *
+ * @param endDateTime Until what date-time should this message be shown, after this date/time this
+ * message SHALL be removed
+ * @return this
+ */
+ public MessageInfo withEndDateTime(@Nullable ZonedDateTime endDateTime) {
+ setEndDateTime(endDateTime);
+ return this;
+ }
+
+ /**
+ * Gets during which transaction shall this message be shown. Message SHALL be removed by the
+ * Charging Station after transaction has ended.
+ *
+ * @return During which transaction shall this message be shown
+ */
+ @Nullable
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ /**
+ * Sets during which transaction shall this message be shown. Message SHALL be removed by the
+ * Charging Station after transaction has ended.
+ *
+ * @param transactionId During which transaction shall this message be shown
+ */
+ public void setTransactionId(@Nullable String transactionId) {
+ if (!isValidTransactionId(transactionId)) {
+ throw new PropertyConstraintException(transactionId, "transactionId is invalid");
+ }
+ this.transactionId = transactionId;
+ }
+
+ /**
+ * Returns whether the given transactionId is valid
+ *
+ * @param transactionId the transactionId to check the validity of
+ * @return {@code true} if transactionId is valid, {@code false} if not
+ */
+ private boolean isValidTransactionId(@Nullable String transactionId) {
+ return transactionId == null || transactionId.length() <= 36;
+ }
+
+ /**
+ * Adds during which transaction shall this message be shown. Message SHALL be removed by the
+ * Charging Station after transaction has ended.
+ *
+ * @param transactionId During which transaction shall this message be shown
+ * @return this
+ */
+ public MessageInfo withTransactionId(@Nullable String transactionId) {
+ setTransactionId(transactionId);
+ return this;
+ }
+
+ /**
+ * Gets message details, for a message to be displayed on a Charging Station.
+ *
+ * @return Message details, for a message to be displayed on a Charging Station
+ */
+ public MessageContent getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets message details, for a message to be displayed on a Charging Station.
+ *
+ * @param message Message details, for a message to be displayed on a Charging Station
+ */
+ public void setMessage(MessageContent message) {
+ if (!isValidMessage(message)) {
+ throw new PropertyConstraintException(message, "message is invalid");
+ }
+ this.message = message;
+ }
+
+ /**
+ * Returns whether the given message is valid
+ *
+ * @param message the message to check the validity of
+ * @return {@code true} if message is valid, {@code false} if not
+ */
+ private boolean isValidMessage(MessageContent message) {
+ return message != null && message.validate();
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidDisplay(display)
+ && isValidId(id)
+ && isValidPriority(priority)
+ && isValidTransactionId(transactionId)
+ && isValidMessage(message);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ MessageInfo that = (MessageInfo) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(display, that.display)
+ && Objects.equals(id, that.id)
+ && Objects.equals(priority, that.priority)
+ && Objects.equals(state, that.state)
+ && Objects.equals(startDateTime, that.startDateTime)
+ && Objects.equals(endDateTime, that.endDateTime)
+ && Objects.equals(transactionId, that.transactionId)
+ && Objects.equals(message, that.message);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ display,
+ id,
+ priority,
+ state,
+ startDateTime,
+ endDateTime,
+ transactionId,
+ message);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("display", display)
+ .add("id", id)
+ .add("priority", priority)
+ .add("state", state)
+ .add("startDateTime", startDateTime)
+ .add("endDateTime", endDateTime)
+ .add("transactionId", transactionId)
+ .add("message", message)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessagePriorityEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessagePriorityEnum.java
new file mode 100644
index 000000000..9c4b70319
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessagePriorityEnum.java
@@ -0,0 +1,36 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Message Info. Priority. Message Priority Code
+ *
+ * With what priority should this message be shown
+ */
+public enum MessagePriorityEnum {
+ AlwaysFront,
+ InFront,
+ NormalCycle
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageStateEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageStateEnum.java
new file mode 100644
index 000000000..d9b6aa884
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageStateEnum.java
@@ -0,0 +1,38 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Message Info. State. Message State Code
+ *
+ * During what state should this message be shown. When omitted this message should be shown in
+ * any state of the Charging Station.
+ */
+public enum MessageStateEnum {
+ Charging,
+ Faulted,
+ Idle,
+ Unavailable
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageTriggerEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageTriggerEnum.java
new file mode 100644
index 000000000..693fa31ee
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MessageTriggerEnum.java
@@ -0,0 +1,40 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Type of message to be triggered. */
+public enum MessageTriggerEnum {
+ BootNotification,
+ LogStatusNotification,
+ FirmwareStatusNotification,
+ Heartbeat,
+ MeterValues,
+ SignChargingStationCertificate,
+ SignV2GCertificate,
+ StatusNotification,
+ TransactionEvent,
+ SignCombinedCertificate,
+ PublishFirmwareStatusNotification
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MeterValue.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MeterValue.java
new file mode 100644
index 000000000..1fbc13036
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MeterValue.java
@@ -0,0 +1,215 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.time.ZonedDateTime;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Meter Value
+ *
+ * Collection of one or more sampled values in MeterValuesRequest and TransactionEvent. All
+ * sampled values in a MeterValue are sampled at the same point in time.
+ */
+public final class MeterValue {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Sampled Value
+ *
+ * Single sampled value in MeterValues. Each value can be accompanied by optional fields.
+ *
+ * To save on mobile data usage, default values of all of the optional fields are such that.
+ * The value without any additional fields will be interpreted, as a register reading of active
+ * import energy in Wh (Watt-hour) units.
+ */
+ private SampledValue[] sampledValue;
+
+ /**
+ * Meter Value. Timestamp. Date Time
+ *
+ * Timestamp for measured value(s).
+ */
+ private ZonedDateTime timestamp;
+
+ /**
+ * Constructor for the MeterValue class
+ *
+ * @param sampledValue Single sampled value in MeterValues. Each value can be accompanied by
+ * optional fields.
+ * @param timestamp Timestamp for measured value(s).
+ */
+ public MeterValue(SampledValue[] sampledValue, ZonedDateTime timestamp) {
+ setSampledValue(sampledValue);
+ setTimestamp(timestamp);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public MeterValue withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets single sampled value in MeterValues. Each value can be accompanied by optional fields.
+ *
+ * @return Single sampled value in MeterValues
+ */
+ public SampledValue[] getSampledValue() {
+ return sampledValue;
+ }
+
+ /**
+ * Sets single sampled value in MeterValues. Each value can be accompanied by optional fields.
+ *
+ * @param sampledValue Single sampled value in MeterValues
+ */
+ public void setSampledValue(SampledValue[] sampledValue) {
+ if (!isValidSampledValue(sampledValue)) {
+ throw new PropertyConstraintException(sampledValue, "sampledValue is invalid");
+ }
+ this.sampledValue = sampledValue;
+ }
+
+ /**
+ * Returns whether the given sampledValue is valid
+ *
+ * @param sampledValue the sampledValue to check the validity of
+ * @return {@code true} if sampledValue is valid, {@code false} if not
+ */
+ private boolean isValidSampledValue(SampledValue[] sampledValue) {
+ return sampledValue != null
+ && sampledValue.length >= 1
+ && Arrays.stream(sampledValue).allMatch(item -> item.validate());
+ }
+
+ /**
+ * Gets timestamp for measured value(s).
+ *
+ * @return Timestamp for measured value(s)
+ */
+ public ZonedDateTime getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * Sets timestamp for measured value(s).
+ *
+ * @param timestamp Timestamp for measured value(s)
+ */
+ public void setTimestamp(ZonedDateTime timestamp) {
+ if (!isValidTimestamp(timestamp)) {
+ throw new PropertyConstraintException(timestamp, "timestamp is invalid");
+ }
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * Returns whether the given timestamp is valid
+ *
+ * @param timestamp the timestamp to check the validity of
+ * @return {@code true} if timestamp is valid, {@code false} if not
+ */
+ private boolean isValidTimestamp(ZonedDateTime timestamp) {
+ return timestamp != null;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidSampledValue(sampledValue)
+ && isValidTimestamp(timestamp);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ MeterValue that = (MeterValue) o;
+ return Objects.equals(customData, that.customData)
+ && Arrays.equals(sampledValue, that.sampledValue)
+ && Objects.equals(timestamp, that.timestamp);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, Arrays.hashCode(sampledValue), timestamp);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("sampledValue", sampledValue)
+ .add("timestamp", timestamp)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Modem.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Modem.java
new file mode 100644
index 000000000..f3f6650b0
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Modem.java
@@ -0,0 +1,219 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Wireless Communication Module
+ *
+ * Parameters required for initiating and maintaining wireless communication with other devices.
+ */
+public final class Modem {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Wireless Communication Module. ICCID. CI20 Text
+ *
+ * The ICCID of the modemâs SIM card.
+ */
+ @Nullable private String iccid;
+
+ /**
+ * Wireless Communication Module. IMSI. CI20 Text
+ *
+ * The IMSI of the modemâs SIM card.
+ */
+ @Nullable private String imsi;
+
+ /** Constructor for the Modem class */
+ public Modem() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public Modem withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the ICCID of the modemâs SIM card.
+ *
+ * @return The ICCID of the modemâs SIM card
+ */
+ @Nullable
+ public String getIccid() {
+ return iccid;
+ }
+
+ /**
+ * Sets the ICCID of the modemâs SIM card.
+ *
+ * @param iccid The ICCID of the modemâs SIM card
+ */
+ public void setIccid(@Nullable String iccid) {
+ if (!isValidIccid(iccid)) {
+ throw new PropertyConstraintException(iccid, "iccid is invalid");
+ }
+ this.iccid = iccid;
+ }
+
+ /**
+ * Returns whether the given iccid is valid
+ *
+ * @param iccid the iccid to check the validity of
+ * @return {@code true} if iccid is valid, {@code false} if not
+ */
+ private boolean isValidIccid(@Nullable String iccid) {
+ return iccid == null || iccid.length() <= 20;
+ }
+
+ /**
+ * Adds the ICCID of the modemâs SIM card.
+ *
+ * @param iccid The ICCID of the modemâs SIM card
+ * @return this
+ */
+ public Modem withIccid(@Nullable String iccid) {
+ setIccid(iccid);
+ return this;
+ }
+
+ /**
+ * Gets the IMSI of the modemâs SIM card.
+ *
+ * @return The IMSI of the modemâs SIM card
+ */
+ @Nullable
+ public String getImsi() {
+ return imsi;
+ }
+
+ /**
+ * Sets the IMSI of the modemâs SIM card.
+ *
+ * @param imsi The IMSI of the modemâs SIM card
+ */
+ public void setImsi(@Nullable String imsi) {
+ if (!isValidImsi(imsi)) {
+ throw new PropertyConstraintException(imsi, "imsi is invalid");
+ }
+ this.imsi = imsi;
+ }
+
+ /**
+ * Returns whether the given imsi is valid
+ *
+ * @param imsi the imsi to check the validity of
+ * @return {@code true} if imsi is valid, {@code false} if not
+ */
+ private boolean isValidImsi(@Nullable String imsi) {
+ return imsi == null || imsi.length() <= 20;
+ }
+
+ /**
+ * Adds the IMSI of the modemâs SIM card.
+ *
+ * @param imsi The IMSI of the modemâs SIM card
+ * @return this
+ */
+ public Modem withImsi(@Nullable String imsi) {
+ setImsi(imsi);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidIccid(iccid) && isValidImsi(imsi);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Modem that = (Modem) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(iccid, that.iccid)
+ && Objects.equals(imsi, that.imsi);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, iccid, imsi);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("iccid", iccid)
+ .add("imsi", imsi)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MonitorEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MonitorEnum.java
new file mode 100644
index 000000000..a0287495c
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MonitorEnum.java
@@ -0,0 +1,34 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The type of this monitor, e.g. a threshold, delta or periodic monitor. */
+public enum MonitorEnum {
+ UpperThreshold,
+ LowerThreshold,
+ Delta,
+ Periodic,
+ PeriodicClockAligned
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MonitoringBaseEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MonitoringBaseEnum.java
new file mode 100644
index 000000000..334b08c21
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MonitoringBaseEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Specify which monitoring base will be set */
+public enum MonitoringBaseEnum {
+ All,
+ FactoryDefault,
+ HardWiredOnly
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MonitoringCriterionEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MonitoringCriterionEnum.java
new file mode 100644
index 000000000..2fbe523f4
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MonitoringCriterionEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** MonitoringCriterionEnumType */
+public enum MonitoringCriterionEnum {
+ ThresholdMonitoring,
+ DeltaMonitoring,
+ PeriodicMonitoring
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MonitoringData.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MonitoringData.java
new file mode 100644
index 000000000..ed06cdbe8
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MonitoringData.java
@@ -0,0 +1,236 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Class to hold parameters of SetVariableMonitoring request. */
+public final class MonitoringData {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** A physical or logical component */
+ private Component component;
+
+ /** Reference key to a component-variable. */
+ private Variable variable;
+
+ /** A monitoring setting for a variable. */
+ private VariableMonitoring[] variableMonitoring;
+
+ /**
+ * Constructor for the MonitoringData class
+ *
+ * @param component A physical or logical component
+ * @param variable Reference key to a component-variable.
+ * @param variableMonitoring A monitoring setting for a variable.
+ */
+ public MonitoringData(
+ Component component, Variable variable, VariableMonitoring[] variableMonitoring) {
+ setComponent(component);
+ setVariable(variable);
+ setVariableMonitoring(variableMonitoring);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public MonitoringData withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets a physical or logical component
+ *
+ * @return A physical or logical component
+ */
+ public Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets a physical or logical component
+ *
+ * @param component A physical or logical component
+ */
+ public void setComponent(Component component) {
+ if (!isValidComponent(component)) {
+ throw new PropertyConstraintException(component, "component is invalid");
+ }
+ this.component = component;
+ }
+
+ /**
+ * Returns whether the given component is valid
+ *
+ * @param component the component to check the validity of
+ * @return {@code true} if component is valid, {@code false} if not
+ */
+ private boolean isValidComponent(Component component) {
+ return component != null && component.validate();
+ }
+
+ /**
+ * Gets reference key to a component-variable.
+ *
+ * @return Reference key to a component-variable
+ */
+ public Variable getVariable() {
+ return variable;
+ }
+
+ /**
+ * Sets reference key to a component-variable.
+ *
+ * @param variable Reference key to a component-variable
+ */
+ public void setVariable(Variable variable) {
+ if (!isValidVariable(variable)) {
+ throw new PropertyConstraintException(variable, "variable is invalid");
+ }
+ this.variable = variable;
+ }
+
+ /**
+ * Returns whether the given variable is valid
+ *
+ * @param variable the variable to check the validity of
+ * @return {@code true} if variable is valid, {@code false} if not
+ */
+ private boolean isValidVariable(Variable variable) {
+ return variable != null && variable.validate();
+ }
+
+ /**
+ * Gets a monitoring setting for a variable.
+ *
+ * @return A monitoring setting for a variable
+ */
+ public VariableMonitoring[] getVariableMonitoring() {
+ return variableMonitoring;
+ }
+
+ /**
+ * Sets a monitoring setting for a variable.
+ *
+ * @param variableMonitoring A monitoring setting for a variable
+ */
+ public void setVariableMonitoring(VariableMonitoring[] variableMonitoring) {
+ if (!isValidVariableMonitoring(variableMonitoring)) {
+ throw new PropertyConstraintException(variableMonitoring, "variableMonitoring is invalid");
+ }
+ this.variableMonitoring = variableMonitoring;
+ }
+
+ /**
+ * Returns whether the given variableMonitoring is valid
+ *
+ * @param variableMonitoring the variableMonitoring to check the validity of
+ * @return {@code true} if variableMonitoring is valid, {@code false} if not
+ */
+ private boolean isValidVariableMonitoring(VariableMonitoring[] variableMonitoring) {
+ return variableMonitoring != null
+ && variableMonitoring.length >= 1
+ && Arrays.stream(variableMonitoring).allMatch(item -> item.validate());
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidComponent(component)
+ && isValidVariable(variable)
+ && isValidVariableMonitoring(variableMonitoring);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ MonitoringData that = (MonitoringData) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(component, that.component)
+ && Objects.equals(variable, that.variable)
+ && Arrays.equals(variableMonitoring, that.variableMonitoring);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, component, variable, Arrays.hashCode(variableMonitoring));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("component", component)
+ .add("variable", variable)
+ .add("variableMonitoring", variableMonitoring)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MutabilityEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MutabilityEnum.java
new file mode 100644
index 000000000..b6714f6ee
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/MutabilityEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The mutability of this attribute. Default is ReadWrite when omitted. */
+public enum MutabilityEnum {
+ ReadOnly,
+ WriteOnly,
+ ReadWrite
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/NetworkConnectionProfile.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/NetworkConnectionProfile.java
new file mode 100644
index 000000000..8ed816d2a
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/NetworkConnectionProfile.java
@@ -0,0 +1,518 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Communication Function
+ *
+ * The NetworkConnectionProfile defines the functional and technical parameters of a
+ * communication link.
+ */
+public final class NetworkConnectionProfile {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * APN
+ *
+ * Collection of configuration data needed to make a data-connection over a cellular network.
+ *
+ * NOTE: When asking a GSM modem to dial in, it is possible to specify which mobile operator
+ * should be used. This can be done with the mobile country code (MCC) in combination with a
+ * mobile network code (MNC). Example: If your preferred network is Vodafone Netherlands, the
+ * MCC=204 and the MNC=04 which means the key PreferredNetwork = 20404 Some modems allows to
+ * specify a preferred network, which means, if this network is not available, a different network
+ * is used. If you specify UseOnlyPreferredNetwork and this network is not available, the modem
+ * will not dial in.
+ */
+ @Nullable private APN apn;
+
+ /**
+ * Communication Function. OCPP Version. OCPP Version Code
+ *
+ * The OCPP version used for this communication function.
+ */
+ private OCPPVersionEnum ocppVersion;
+
+ /**
+ * Communication Function. OCPP Transport. OCPP Transport Code
+ *
+ * The transport protocol (e.g. SOAP or JSON). Note: SOAP is not supported in OCPP 2.0, but is
+ * supported by other versions of OCPP.
+ */
+ private OCPPTransportEnum ocppTransport;
+
+ /**
+ * Communication Function. OCPP Central System URL. URI
+ *
+ * URL of the CSMS(s) that this Charging Station communicates with.
+ */
+ private String ocppCsmsUrl;
+
+ /**
+ * Duration in seconds before a message send by the Charging Station via this network connection
+ * times-out. The best setting depends on the underlying network and response times of the CSMS.
+ * If you are looking for a some guideline: use 30 seconds as a starting point.
+ */
+ private Integer messageTimeout;
+
+ /** The security profile used when connecting to the CSMS with this NetworkConnectionProfile. */
+ private Integer securityProfile;
+
+ /** Applicable Network Interface. */
+ private OCPPInterfaceEnum ocppInterface;
+
+ /**
+ * VPN
+ *
+ * VPN Configuration settings
+ */
+ @Nullable private VPN vpn;
+
+ /**
+ * Constructor for the NetworkConnectionProfile class
+ *
+ * @param ocppVersion The OCPP version used for this communication function.
+ * @param ocppTransport The transport protocol (e.g. SOAP or JSON). Note: SOAP is not supported in
+ * OCPP 2.0, but is supported by other versions of OCPP.
+ * @param ocppCsmsUrl URL of the CSMS(s) that this Charging Station communicates with.
+ * @param messageTimeout Duration in seconds before a message send by the Charging Station via
+ * this network connection times-out. The best setting depends on the underlying network and
+ * response times of the CSMS. If you are looking for a some guideline: use 30 seconds as a
+ * starting point.
+ * @param securityProfile The security profile used when connecting to the CSMS with this
+ * NetworkConnectionProfile.
+ * @param ocppInterface Applicable Network Interface.
+ */
+ public NetworkConnectionProfile(
+ OCPPVersionEnum ocppVersion,
+ OCPPTransportEnum ocppTransport,
+ String ocppCsmsUrl,
+ Integer messageTimeout,
+ Integer securityProfile,
+ OCPPInterfaceEnum ocppInterface) {
+ setOcppVersion(ocppVersion);
+ setOcppTransport(ocppTransport);
+ setOcppCsmsUrl(ocppCsmsUrl);
+ setMessageTimeout(messageTimeout);
+ setSecurityProfile(securityProfile);
+ setOcppInterface(ocppInterface);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public NetworkConnectionProfile withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets collection of configuration data needed to make a data-connection over a cellular network.
+ *
+ * @return Collection of configuration data needed to make a data-connection over a cellular
+ * network
+ */
+ @Nullable
+ public APN getApn() {
+ return apn;
+ }
+
+ /**
+ * Sets collection of configuration data needed to make a data-connection over a cellular network.
+ *
+ * @param apn Collection of configuration data needed to make a data-connection over a cellular
+ * network
+ */
+ public void setApn(@Nullable APN apn) {
+ if (!isValidApn(apn)) {
+ throw new PropertyConstraintException(apn, "apn is invalid");
+ }
+ this.apn = apn;
+ }
+
+ /**
+ * Returns whether the given apn is valid
+ *
+ * @param apn the apn to check the validity of
+ * @return {@code true} if apn is valid, {@code false} if not
+ */
+ private boolean isValidApn(@Nullable APN apn) {
+ return apn == null || apn.validate();
+ }
+
+ /**
+ * Adds collection of configuration data needed to make a data-connection over a cellular network.
+ *
+ * @param apn Collection of configuration data needed to make a data-connection over a cellular
+ * network
+ * @return this
+ */
+ public NetworkConnectionProfile withApn(@Nullable APN apn) {
+ setApn(apn);
+ return this;
+ }
+
+ /**
+ * Gets the OCPP version used for this communication function.
+ *
+ * @return The OCPP version used for this communication function
+ */
+ public OCPPVersionEnum getOcppVersion() {
+ return ocppVersion;
+ }
+
+ /**
+ * Sets the OCPP version used for this communication function.
+ *
+ * @param ocppVersion The OCPP version used for this communication function
+ */
+ public void setOcppVersion(OCPPVersionEnum ocppVersion) {
+ if (!isValidOcppVersion(ocppVersion)) {
+ throw new PropertyConstraintException(ocppVersion, "ocppVersion is invalid");
+ }
+ this.ocppVersion = ocppVersion;
+ }
+
+ /**
+ * Returns whether the given ocppVersion is valid
+ *
+ * @param ocppVersion the ocppVersion to check the validity of
+ * @return {@code true} if ocppVersion is valid, {@code false} if not
+ */
+ private boolean isValidOcppVersion(OCPPVersionEnum ocppVersion) {
+ return ocppVersion != null;
+ }
+
+ /**
+ * Gets the transport protocol (e.g. SOAP or JSON). Note: SOAP is not supported in OCPP 2.0, but
+ * is supported by other versions of OCPP.
+ *
+ * @return The transport protocol (e.g. SOAP or JSON)
+ */
+ public OCPPTransportEnum getOcppTransport() {
+ return ocppTransport;
+ }
+
+ /**
+ * Sets the transport protocol (e.g. SOAP or JSON). Note: SOAP is not supported in OCPP 2.0, but
+ * is supported by other versions of OCPP.
+ *
+ * @param ocppTransport The transport protocol (e.g. SOAP or JSON)
+ */
+ public void setOcppTransport(OCPPTransportEnum ocppTransport) {
+ if (!isValidOcppTransport(ocppTransport)) {
+ throw new PropertyConstraintException(ocppTransport, "ocppTransport is invalid");
+ }
+ this.ocppTransport = ocppTransport;
+ }
+
+ /**
+ * Returns whether the given ocppTransport is valid
+ *
+ * @param ocppTransport the ocppTransport to check the validity of
+ * @return {@code true} if ocppTransport is valid, {@code false} if not
+ */
+ private boolean isValidOcppTransport(OCPPTransportEnum ocppTransport) {
+ return ocppTransport != null;
+ }
+
+ /**
+ * Gets URL of the CSMS(s) that this Charging Station communicates with.
+ *
+ * @return URL of the CSMS(s) that this Charging Station communicates with
+ */
+ public String getOcppCsmsUrl() {
+ return ocppCsmsUrl;
+ }
+
+ /**
+ * Sets URL of the CSMS(s) that this Charging Station communicates with.
+ *
+ * @param ocppCsmsUrl URL of the CSMS(s) that this Charging Station communicates with
+ */
+ public void setOcppCsmsUrl(String ocppCsmsUrl) {
+ if (!isValidOcppCsmsUrl(ocppCsmsUrl)) {
+ throw new PropertyConstraintException(ocppCsmsUrl, "ocppCsmsUrl is invalid");
+ }
+ this.ocppCsmsUrl = ocppCsmsUrl;
+ }
+
+ /**
+ * Returns whether the given ocppCsmsUrl is valid
+ *
+ * @param ocppCsmsUrl the ocppCsmsUrl to check the validity of
+ * @return {@code true} if ocppCsmsUrl is valid, {@code false} if not
+ */
+ private boolean isValidOcppCsmsUrl(String ocppCsmsUrl) {
+ return ocppCsmsUrl != null && ocppCsmsUrl.length() <= 512;
+ }
+
+ /**
+ * Gets duration in seconds before a message send by the Charging Station via this network
+ * connection times-out. The best setting depends on the underlying network and response times of
+ * the CSMS. If you are looking for a some guideline: use 30 seconds as a starting point.
+ *
+ * @return Duration in seconds before a message send by the Charging Station via this network
+ * connection times-out
+ */
+ public Integer getMessageTimeout() {
+ return messageTimeout;
+ }
+
+ /**
+ * Sets duration in seconds before a message send by the Charging Station via this network
+ * connection times-out. The best setting depends on the underlying network and response times of
+ * the CSMS. If you are looking for a some guideline: use 30 seconds as a starting point.
+ *
+ * @param messageTimeout Duration in seconds before a message send by the Charging Station via
+ * this network connection times-out
+ */
+ public void setMessageTimeout(Integer messageTimeout) {
+ if (!isValidMessageTimeout(messageTimeout)) {
+ throw new PropertyConstraintException(messageTimeout, "messageTimeout is invalid");
+ }
+ this.messageTimeout = messageTimeout;
+ }
+
+ /**
+ * Returns whether the given messageTimeout is valid
+ *
+ * @param messageTimeout the messageTimeout to check the validity of
+ * @return {@code true} if messageTimeout is valid, {@code false} if not
+ */
+ private boolean isValidMessageTimeout(Integer messageTimeout) {
+ return messageTimeout != null;
+ }
+
+ /**
+ * Gets the security profile used when connecting to the CSMS with this NetworkConnectionProfile.
+ *
+ * @return The security profile used when connecting to the CSMS with this
+ * NetworkConnectionProfile
+ */
+ public Integer getSecurityProfile() {
+ return securityProfile;
+ }
+
+ /**
+ * Sets the security profile used when connecting to the CSMS with this NetworkConnectionProfile.
+ *
+ * @param securityProfile The security profile used when connecting to the CSMS with this
+ * NetworkConnectionProfile
+ */
+ public void setSecurityProfile(Integer securityProfile) {
+ if (!isValidSecurityProfile(securityProfile)) {
+ throw new PropertyConstraintException(securityProfile, "securityProfile is invalid");
+ }
+ this.securityProfile = securityProfile;
+ }
+
+ /**
+ * Returns whether the given securityProfile is valid
+ *
+ * @param securityProfile the securityProfile to check the validity of
+ * @return {@code true} if securityProfile is valid, {@code false} if not
+ */
+ private boolean isValidSecurityProfile(Integer securityProfile) {
+ return securityProfile != null;
+ }
+
+ /**
+ * Gets applicable Network Interface.
+ *
+ * @return Applicable Network Interface
+ */
+ public OCPPInterfaceEnum getOcppInterface() {
+ return ocppInterface;
+ }
+
+ /**
+ * Sets applicable Network Interface.
+ *
+ * @param ocppInterface Applicable Network Interface
+ */
+ public void setOcppInterface(OCPPInterfaceEnum ocppInterface) {
+ if (!isValidOcppInterface(ocppInterface)) {
+ throw new PropertyConstraintException(ocppInterface, "ocppInterface is invalid");
+ }
+ this.ocppInterface = ocppInterface;
+ }
+
+ /**
+ * Returns whether the given ocppInterface is valid
+ *
+ * @param ocppInterface the ocppInterface to check the validity of
+ * @return {@code true} if ocppInterface is valid, {@code false} if not
+ */
+ private boolean isValidOcppInterface(OCPPInterfaceEnum ocppInterface) {
+ return ocppInterface != null;
+ }
+
+ /**
+ * Gets VPN Configuration settings
+ *
+ * @return VPN Configuration settings
+ */
+ @Nullable
+ public VPN getVpn() {
+ return vpn;
+ }
+
+ /**
+ * Sets VPN Configuration settings
+ *
+ * @param vpn VPN Configuration settings
+ */
+ public void setVpn(@Nullable VPN vpn) {
+ if (!isValidVpn(vpn)) {
+ throw new PropertyConstraintException(vpn, "vpn is invalid");
+ }
+ this.vpn = vpn;
+ }
+
+ /**
+ * Returns whether the given vpn is valid
+ *
+ * @param vpn the vpn to check the validity of
+ * @return {@code true} if vpn is valid, {@code false} if not
+ */
+ private boolean isValidVpn(@Nullable VPN vpn) {
+ return vpn == null || vpn.validate();
+ }
+
+ /**
+ * Adds VPN Configuration settings
+ *
+ * @param vpn VPN Configuration settings
+ * @return this
+ */
+ public NetworkConnectionProfile withVpn(@Nullable VPN vpn) {
+ setVpn(vpn);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidApn(apn)
+ && isValidOcppVersion(ocppVersion)
+ && isValidOcppTransport(ocppTransport)
+ && isValidOcppCsmsUrl(ocppCsmsUrl)
+ && isValidMessageTimeout(messageTimeout)
+ && isValidSecurityProfile(securityProfile)
+ && isValidOcppInterface(ocppInterface)
+ && isValidVpn(vpn);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ NetworkConnectionProfile that = (NetworkConnectionProfile) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(apn, that.apn)
+ && Objects.equals(ocppVersion, that.ocppVersion)
+ && Objects.equals(ocppTransport, that.ocppTransport)
+ && Objects.equals(ocppCsmsUrl, that.ocppCsmsUrl)
+ && Objects.equals(messageTimeout, that.messageTimeout)
+ && Objects.equals(securityProfile, that.securityProfile)
+ && Objects.equals(ocppInterface, that.ocppInterface)
+ && Objects.equals(vpn, that.vpn);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ apn,
+ ocppVersion,
+ ocppTransport,
+ ocppCsmsUrl,
+ messageTimeout,
+ securityProfile,
+ ocppInterface,
+ vpn);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("apn", apn)
+ .add("ocppVersion", ocppVersion)
+ .add("ocppTransport", ocppTransport)
+ .add("ocppCsmsUrl", ocppCsmsUrl)
+ .add("messageTimeout", messageTimeout)
+ .add("securityProfile", securityProfile)
+ .add("ocppInterface", ocppInterface)
+ .add("vpn", vpn)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/NotifyEVChargingNeedsStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/NotifyEVChargingNeedsStatusEnum.java
new file mode 100644
index 000000000..00322e886
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/NotifyEVChargingNeedsStatusEnum.java
@@ -0,0 +1,35 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Returns whether the CSMS has been able to process the message successfully. It does not imply
+ * that the evChargingNeeds can be met with the current charging profile.
+ */
+public enum NotifyEVChargingNeedsStatusEnum {
+ Accepted,
+ Rejected,
+ Processing
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OCPPInterfaceEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OCPPInterfaceEnum.java
new file mode 100644
index 000000000..b75c527db
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OCPPInterfaceEnum.java
@@ -0,0 +1,37 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Applicable Network Interface. */
+public enum OCPPInterfaceEnum {
+ Wired0,
+ Wired1,
+ Wired2,
+ Wired3,
+ Wireless0,
+ Wireless1,
+ Wireless2,
+ Wireless3
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OCPPTransportEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OCPPTransportEnum.java
new file mode 100644
index 000000000..bc00a5512
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OCPPTransportEnum.java
@@ -0,0 +1,36 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Communication Function. OCPP Transport. OCPP Transport Code
+ *
+ * The transport protocol (e.g. SOAP or JSON). Note: SOAP is not supported in OCPP 2.0, but is
+ * supported by other versions of OCPP.
+ */
+public enum OCPPTransportEnum {
+ JSON,
+ SOAP
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OCPPVersionEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OCPPVersionEnum.java
new file mode 100644
index 000000000..6ff685ec1
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OCPPVersionEnum.java
@@ -0,0 +1,37 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Communication Function. OCPP Version. OCPP Version Code
+ *
+ * The OCPP version used for this communication function.
+ */
+public enum OCPPVersionEnum {
+ OCPP12,
+ OCPP15,
+ OCPP16,
+ OCPP20
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OCSPRequestData.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OCSPRequestData.java
new file mode 100644
index 000000000..a46c7908d
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OCSPRequestData.java
@@ -0,0 +1,316 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** OCSPRequestDataType */
+public final class OCSPRequestData {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Used algorithms for the hashes provided. */
+ private HashAlgorithmEnum hashAlgorithm;
+
+ /** Hashed value of the Issuer DN (Distinguished Name). */
+ private String issuerNameHash;
+
+ /** Hashed value of the issuers public key */
+ private String issuerKeyHash;
+
+ /** The serial number of the certificate. */
+ private String serialNumber;
+
+ /** The responder URL (Case insensitive). */
+ private String responderURL;
+
+ /**
+ * Constructor for the OCSPRequestData class
+ *
+ * @param hashAlgorithm Used algorithms for the hashes provided.
+ * @param issuerNameHash Hashed value of the Issuer DN (Distinguished Name).
+ * @param issuerKeyHash Hashed value of the issuers public key
+ * @param serialNumber The serial number of the certificate.
+ * @param responderURL The responder URL (Case insensitive).
+ */
+ public OCSPRequestData(
+ HashAlgorithmEnum hashAlgorithm,
+ String issuerNameHash,
+ String issuerKeyHash,
+ String serialNumber,
+ String responderURL) {
+ setHashAlgorithm(hashAlgorithm);
+ setIssuerNameHash(issuerNameHash);
+ setIssuerKeyHash(issuerKeyHash);
+ setSerialNumber(serialNumber);
+ setResponderURL(responderURL);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public OCSPRequestData withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets used algorithms for the hashes provided.
+ *
+ * @return Used algorithms for the hashes provided
+ */
+ public HashAlgorithmEnum getHashAlgorithm() {
+ return hashAlgorithm;
+ }
+
+ /**
+ * Sets used algorithms for the hashes provided.
+ *
+ * @param hashAlgorithm Used algorithms for the hashes provided
+ */
+ public void setHashAlgorithm(HashAlgorithmEnum hashAlgorithm) {
+ if (!isValidHashAlgorithm(hashAlgorithm)) {
+ throw new PropertyConstraintException(hashAlgorithm, "hashAlgorithm is invalid");
+ }
+ this.hashAlgorithm = hashAlgorithm;
+ }
+
+ /**
+ * Returns whether the given hashAlgorithm is valid
+ *
+ * @param hashAlgorithm the hashAlgorithm to check the validity of
+ * @return {@code true} if hashAlgorithm is valid, {@code false} if not
+ */
+ private boolean isValidHashAlgorithm(HashAlgorithmEnum hashAlgorithm) {
+ return hashAlgorithm != null;
+ }
+
+ /**
+ * Gets hashed value of the Issuer DN (Distinguished Name).
+ *
+ * @return Hashed value of the Issuer DN (Distinguished Name)
+ */
+ public String getIssuerNameHash() {
+ return issuerNameHash;
+ }
+
+ /**
+ * Sets hashed value of the Issuer DN (Distinguished Name).
+ *
+ * @param issuerNameHash Hashed value of the Issuer DN (Distinguished Name)
+ */
+ public void setIssuerNameHash(String issuerNameHash) {
+ if (!isValidIssuerNameHash(issuerNameHash)) {
+ throw new PropertyConstraintException(issuerNameHash, "issuerNameHash is invalid");
+ }
+ this.issuerNameHash = issuerNameHash;
+ }
+
+ /**
+ * Returns whether the given issuerNameHash is valid
+ *
+ * @param issuerNameHash the issuerNameHash to check the validity of
+ * @return {@code true} if issuerNameHash is valid, {@code false} if not
+ */
+ private boolean isValidIssuerNameHash(String issuerNameHash) {
+ return issuerNameHash != null && issuerNameHash.length() <= 128;
+ }
+
+ /**
+ * Gets hashed value of the issuers public key
+ *
+ * @return Hashed value of the issuers public key
+ */
+ public String getIssuerKeyHash() {
+ return issuerKeyHash;
+ }
+
+ /**
+ * Sets hashed value of the issuers public key
+ *
+ * @param issuerKeyHash Hashed value of the issuers public key
+ */
+ public void setIssuerKeyHash(String issuerKeyHash) {
+ if (!isValidIssuerKeyHash(issuerKeyHash)) {
+ throw new PropertyConstraintException(issuerKeyHash, "issuerKeyHash is invalid");
+ }
+ this.issuerKeyHash = issuerKeyHash;
+ }
+
+ /**
+ * Returns whether the given issuerKeyHash is valid
+ *
+ * @param issuerKeyHash the issuerKeyHash to check the validity of
+ * @return {@code true} if issuerKeyHash is valid, {@code false} if not
+ */
+ private boolean isValidIssuerKeyHash(String issuerKeyHash) {
+ return issuerKeyHash != null && issuerKeyHash.length() <= 128;
+ }
+
+ /**
+ * Gets the serial number of the certificate.
+ *
+ * @return The serial number of the certificate
+ */
+ public String getSerialNumber() {
+ return serialNumber;
+ }
+
+ /**
+ * Sets the serial number of the certificate.
+ *
+ * @param serialNumber The serial number of the certificate
+ */
+ public void setSerialNumber(String serialNumber) {
+ if (!isValidSerialNumber(serialNumber)) {
+ throw new PropertyConstraintException(serialNumber, "serialNumber is invalid");
+ }
+ this.serialNumber = serialNumber;
+ }
+
+ /**
+ * Returns whether the given serialNumber is valid
+ *
+ * @param serialNumber the serialNumber to check the validity of
+ * @return {@code true} if serialNumber is valid, {@code false} if not
+ */
+ private boolean isValidSerialNumber(String serialNumber) {
+ return serialNumber != null && serialNumber.length() <= 40;
+ }
+
+ /**
+ * Gets the responder URL (Case insensitive).
+ *
+ * @return The responder URL (Case insensitive)
+ */
+ public String getResponderURL() {
+ return responderURL;
+ }
+
+ /**
+ * Sets the responder URL (Case insensitive).
+ *
+ * @param responderURL The responder URL (Case insensitive)
+ */
+ public void setResponderURL(String responderURL) {
+ if (!isValidResponderURL(responderURL)) {
+ throw new PropertyConstraintException(responderURL, "responderURL is invalid");
+ }
+ this.responderURL = responderURL;
+ }
+
+ /**
+ * Returns whether the given responderURL is valid
+ *
+ * @param responderURL the responderURL to check the validity of
+ * @return {@code true} if responderURL is valid, {@code false} if not
+ */
+ private boolean isValidResponderURL(String responderURL) {
+ return responderURL != null && responderURL.length() <= 512;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidHashAlgorithm(hashAlgorithm)
+ && isValidIssuerNameHash(issuerNameHash)
+ && isValidIssuerKeyHash(issuerKeyHash)
+ && isValidSerialNumber(serialNumber)
+ && isValidResponderURL(responderURL);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ OCSPRequestData that = (OCSPRequestData) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(hashAlgorithm, that.hashAlgorithm)
+ && Objects.equals(issuerNameHash, that.issuerNameHash)
+ && Objects.equals(issuerKeyHash, that.issuerKeyHash)
+ && Objects.equals(serialNumber, that.serialNumber)
+ && Objects.equals(responderURL, that.responderURL);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, hashAlgorithm, issuerNameHash, issuerKeyHash, serialNumber, responderURL);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("hashAlgorithm", hashAlgorithm)
+ .add("issuerNameHash", issuerNameHash)
+ .add("issuerKeyHash", issuerKeyHash)
+ .add("serialNumber", serialNumber)
+ .add("responderURL", responderURL)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OperationalStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OperationalStatusEnum.java
new file mode 100644
index 000000000..22dab92d8
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/OperationalStatusEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The type of availability change that the Charging Station should perform. */
+public enum OperationalStatusEnum {
+ Inoperative,
+ Operative
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/PhaseEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/PhaseEnum.java
new file mode 100644
index 000000000..9c0f6fd10
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/PhaseEnum.java
@@ -0,0 +1,53 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Sampled Value. Phase. Phase Code
+ *
+ * How the measured value is to be interpreted. For instance between L1 and neutral (L1-N) Please
+ * note that not all values of phase are applicable to all Measurands. When phase is absent, the
+ * measured value is interpreted as an overall value.
+ */
+public enum PhaseEnum {
+ L1,
+ L2,
+ L3,
+ N,
+ @SerializedName("L1-N")
+ L1_N,
+ @SerializedName("L2-N")
+ L2_N,
+ @SerializedName("L3-N")
+ L3_N,
+ @SerializedName("L1-L2")
+ L1_L2,
+ @SerializedName("L2-L3")
+ L2_L3,
+ @SerializedName("L3-L1")
+ L3_L1
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/PublishFirmwareStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/PublishFirmwareStatusEnum.java
new file mode 100644
index 000000000..6d450642f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/PublishFirmwareStatusEnum.java
@@ -0,0 +1,39 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The progress status of the publishfirmware installation. */
+public enum PublishFirmwareStatusEnum {
+ Idle,
+ DownloadScheduled,
+ Downloading,
+ Downloaded,
+ Published,
+ DownloadFailed,
+ DownloadPaused,
+ InvalidChecksum,
+ ChecksumVerified,
+ PublishFailed
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReadingContextEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReadingContextEnum.java
new file mode 100644
index 000000000..d5f107835
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReadingContextEnum.java
@@ -0,0 +1,49 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Sampled Value. Context. Reading Context Code
+ *
+ * Type of detail value: start, end or sample. Default = "Sample.Periodic"
+ */
+public enum ReadingContextEnum {
+ @SerializedName("Interruption.Begin")
+ InterruptionBegin,
+ @SerializedName("Interruption.End")
+ InterruptionEnd,
+ Other,
+ @SerializedName("Sample.Clock")
+ SampleClock,
+ @SerializedName("Sample.Periodic")
+ SamplePeriodic,
+ @SerializedName("Transaction.Begin")
+ TransactionBegin,
+ @SerializedName("Transaction.End")
+ TransactionEnd,
+ Trigger
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReasonEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReasonEnum.java
new file mode 100644
index 000000000..eb35b8243
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReasonEnum.java
@@ -0,0 +1,52 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Transaction. Stopped Reason. EOT Reason Code
+ *
+ * The reason why the transaction was stopped. MAY only be omitted when Reason is "Local".
+ */
+public enum ReasonEnum {
+ DeAuthorized,
+ EmergencyStop,
+ EnergyLimitReached,
+ EVDisconnected,
+ GroundFault,
+ ImmediateReset,
+ Local,
+ LocalOutOfCredit,
+ MasterPass,
+ Other,
+ OvercurrentFault,
+ PowerLoss,
+ PowerQuality,
+ Reboot,
+ Remote,
+ SOCLimitReached,
+ StoppedByEV,
+ TimeLimitReached,
+ Timeout
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/RecurrencyKindEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/RecurrencyKindEnum.java
new file mode 100644
index 000000000..ad8b184ae
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/RecurrencyKindEnum.java
@@ -0,0 +1,35 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Charging Profile. Recurrency Kind. Recurrency Kind Code
+ *
+ * The start point of a recurrence.
+ */
+public enum RecurrencyKindEnum {
+ Daily,
+ Weekly
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/RegistrationStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/RegistrationStatusEnum.java
new file mode 100644
index 000000000..30f45fc52
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/RegistrationStatusEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether the Charging Station has been registered within the CSMS. */
+public enum RegistrationStatusEnum {
+ Accepted,
+ Pending,
+ Rejected
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/RelativeTimeInterval.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/RelativeTimeInterval.java
new file mode 100644
index 000000000..21b1dc39f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/RelativeTimeInterval.java
@@ -0,0 +1,196 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Relative Timer Interval */
+public final class RelativeTimeInterval {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Relative Timer Interval. Start. Elapsed Time
+ *
+ * Start of the interval, in seconds from NOW.
+ */
+ private Integer start;
+
+ /**
+ * Relative Timer Interval. Duration. Elapsed Time
+ *
+ * Duration of the interval, in seconds.
+ */
+ @Nullable private Integer duration;
+
+ /**
+ * Constructor for the RelativeTimeInterval class
+ *
+ * @param start Start of the interval, in seconds from NOW.
+ */
+ public RelativeTimeInterval(Integer start) {
+ setStart(start);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public RelativeTimeInterval withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets start of the interval, in seconds from NOW.
+ *
+ * @return Start of the interval, in seconds from NOW
+ */
+ public Integer getStart() {
+ return start;
+ }
+
+ /**
+ * Sets start of the interval, in seconds from NOW.
+ *
+ * @param start Start of the interval, in seconds from NOW
+ */
+ public void setStart(Integer start) {
+ if (!isValidStart(start)) {
+ throw new PropertyConstraintException(start, "start is invalid");
+ }
+ this.start = start;
+ }
+
+ /**
+ * Returns whether the given start is valid
+ *
+ * @param start the start to check the validity of
+ * @return {@code true} if start is valid, {@code false} if not
+ */
+ private boolean isValidStart(Integer start) {
+ return start != null;
+ }
+
+ /**
+ * Gets duration of the interval, in seconds.
+ *
+ * @return Duration of the interval, in seconds
+ */
+ @Nullable
+ public Integer getDuration() {
+ return duration;
+ }
+
+ /**
+ * Sets duration of the interval, in seconds.
+ *
+ * @param duration Duration of the interval, in seconds
+ */
+ public void setDuration(@Nullable Integer duration) {
+ this.duration = duration;
+ }
+
+ /**
+ * Adds duration of the interval, in seconds.
+ *
+ * @param duration Duration of the interval, in seconds
+ * @return this
+ */
+ public RelativeTimeInterval withDuration(@Nullable Integer duration) {
+ setDuration(duration);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidStart(start);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ RelativeTimeInterval that = (RelativeTimeInterval) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(start, that.start)
+ && Objects.equals(duration, that.duration);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, start, duration);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("start", start)
+ .add("duration", duration)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReportBaseEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReportBaseEnum.java
new file mode 100644
index 000000000..fe30d64a4
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReportBaseEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The report base. */
+public enum ReportBaseEnum {
+ ConfigurationInventory,
+ FullInventory,
+ SummaryInventory
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReportData.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReportData.java
new file mode 100644
index 000000000..f45e82ce3
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReportData.java
@@ -0,0 +1,294 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Class to report components, variables and variable attributes and characteristics. */
+public final class ReportData {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** A physical or logical component */
+ private Component component;
+
+ /** Reference key to a component-variable. */
+ private Variable variable;
+
+ /** Attribute data of a variable. */
+ private VariableAttribute[] variableAttribute;
+
+ /** Fixed read-only parameters of a variable. */
+ @Nullable private VariableCharacteristics variableCharacteristics;
+
+ /**
+ * Constructor for the ReportData class
+ *
+ * @param component A physical or logical component
+ * @param variable Reference key to a component-variable.
+ * @param variableAttribute Attribute data of a variable.
+ */
+ public ReportData(Component component, Variable variable, VariableAttribute[] variableAttribute) {
+ setComponent(component);
+ setVariable(variable);
+ setVariableAttribute(variableAttribute);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public ReportData withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets a physical or logical component
+ *
+ * @return A physical or logical component
+ */
+ public Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets a physical or logical component
+ *
+ * @param component A physical or logical component
+ */
+ public void setComponent(Component component) {
+ if (!isValidComponent(component)) {
+ throw new PropertyConstraintException(component, "component is invalid");
+ }
+ this.component = component;
+ }
+
+ /**
+ * Returns whether the given component is valid
+ *
+ * @param component the component to check the validity of
+ * @return {@code true} if component is valid, {@code false} if not
+ */
+ private boolean isValidComponent(Component component) {
+ return component != null && component.validate();
+ }
+
+ /**
+ * Gets reference key to a component-variable.
+ *
+ * @return Reference key to a component-variable
+ */
+ public Variable getVariable() {
+ return variable;
+ }
+
+ /**
+ * Sets reference key to a component-variable.
+ *
+ * @param variable Reference key to a component-variable
+ */
+ public void setVariable(Variable variable) {
+ if (!isValidVariable(variable)) {
+ throw new PropertyConstraintException(variable, "variable is invalid");
+ }
+ this.variable = variable;
+ }
+
+ /**
+ * Returns whether the given variable is valid
+ *
+ * @param variable the variable to check the validity of
+ * @return {@code true} if variable is valid, {@code false} if not
+ */
+ private boolean isValidVariable(Variable variable) {
+ return variable != null && variable.validate();
+ }
+
+ /**
+ * Gets attribute data of a variable.
+ *
+ * @return Attribute data of a variable
+ */
+ public VariableAttribute[] getVariableAttribute() {
+ return variableAttribute;
+ }
+
+ /**
+ * Sets attribute data of a variable.
+ *
+ * @param variableAttribute Attribute data of a variable
+ */
+ public void setVariableAttribute(VariableAttribute[] variableAttribute) {
+ if (!isValidVariableAttribute(variableAttribute)) {
+ throw new PropertyConstraintException(variableAttribute, "variableAttribute is invalid");
+ }
+ this.variableAttribute = variableAttribute;
+ }
+
+ /**
+ * Returns whether the given variableAttribute is valid
+ *
+ * @param variableAttribute the variableAttribute to check the validity of
+ * @return {@code true} if variableAttribute is valid, {@code false} if not
+ */
+ private boolean isValidVariableAttribute(VariableAttribute[] variableAttribute) {
+ return variableAttribute != null
+ && variableAttribute.length >= 1
+ && variableAttribute.length <= 4
+ && Arrays.stream(variableAttribute).allMatch(item -> item.validate());
+ }
+
+ /**
+ * Gets fixed read-only parameters of a variable.
+ *
+ * @return Fixed read-only parameters of a variable
+ */
+ @Nullable
+ public VariableCharacteristics getVariableCharacteristics() {
+ return variableCharacteristics;
+ }
+
+ /**
+ * Sets fixed read-only parameters of a variable.
+ *
+ * @param variableCharacteristics Fixed read-only parameters of a variable
+ */
+ public void setVariableCharacteristics(
+ @Nullable VariableCharacteristics variableCharacteristics) {
+ if (!isValidVariableCharacteristics(variableCharacteristics)) {
+ throw new PropertyConstraintException(
+ variableCharacteristics, "variableCharacteristics is invalid");
+ }
+ this.variableCharacteristics = variableCharacteristics;
+ }
+
+ /**
+ * Returns whether the given variableCharacteristics is valid
+ *
+ * @param variableCharacteristics the variableCharacteristics to check the validity of
+ * @return {@code true} if variableCharacteristics is valid, {@code false} if not
+ */
+ private boolean isValidVariableCharacteristics(
+ @Nullable VariableCharacteristics variableCharacteristics) {
+ return variableCharacteristics == null || variableCharacteristics.validate();
+ }
+
+ /**
+ * Adds fixed read-only parameters of a variable.
+ *
+ * @param variableCharacteristics Fixed read-only parameters of a variable
+ * @return this
+ */
+ public ReportData withVariableCharacteristics(
+ @Nullable VariableCharacteristics variableCharacteristics) {
+ setVariableCharacteristics(variableCharacteristics);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidComponent(component)
+ && isValidVariable(variable)
+ && isValidVariableAttribute(variableAttribute)
+ && isValidVariableCharacteristics(variableCharacteristics);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ReportData that = (ReportData) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(component, that.component)
+ && Objects.equals(variable, that.variable)
+ && Arrays.equals(variableAttribute, that.variableAttribute)
+ && Objects.equals(variableCharacteristics, that.variableCharacteristics);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ component,
+ variable,
+ Arrays.hashCode(variableAttribute),
+ variableCharacteristics);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("component", component)
+ .add("variable", variable)
+ .add("variableAttribute", variableAttribute)
+ .add("variableCharacteristics", variableCharacteristics)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/RequestStartStopStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/RequestStartStopStatusEnum.java
new file mode 100644
index 000000000..f29d4aff1
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/RequestStartStopStatusEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Status indicating whether Charging Station accepts the request to stop a transaction. */
+public enum RequestStartStopStatusEnum {
+ Accepted,
+ Rejected
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReservationUpdateStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReservationUpdateStatusEnum.java
new file mode 100644
index 000000000..6a9870158
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReservationUpdateStatusEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The updated reservation status. */
+public enum ReservationUpdateStatusEnum {
+ Expired,
+ Removed
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReserveNowStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReserveNowStatusEnum.java
new file mode 100644
index 000000000..4e1f21062
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ReserveNowStatusEnum.java
@@ -0,0 +1,34 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The success or failure of the reservation. */
+public enum ReserveNowStatusEnum {
+ Accepted,
+ Faulted,
+ Occupied,
+ Rejected,
+ Unavailable
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ResetEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ResetEnum.java
new file mode 100644
index 000000000..4845f9f56
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ResetEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The type of reset that the Charging Station or EVSE should perform. */
+public enum ResetEnum {
+ Immediate,
+ OnIdle
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ResetStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ResetStatusEnum.java
new file mode 100644
index 000000000..ad9ba35b6
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ResetStatusEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether the Charging Station is able to perform the reset. */
+public enum ResetStatusEnum {
+ Accepted,
+ Rejected,
+ Scheduled
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SalesTariff.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SalesTariff.java
new file mode 100644
index 000000000..406bc7717
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SalesTariff.java
@@ -0,0 +1,312 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Sales Tariff
+ *
+ * NOTE: This dataType is based on dataTypes from ISO 15118-2.
+ */
+public final class SalesTariff {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Identified Object. MRID. Numeric Identifier
+ *
+ * SalesTariff identifier used to identify one sales tariff. An SAID remains a unique
+ * identifier for one schedule throughout a charging session.
+ */
+ private Integer id;
+
+ /**
+ * Sales Tariff. Sales. Tariff Description
+ *
+ * A human readable title/short description of the sales tariff e.g. for HMI display purposes.
+ */
+ @Nullable private String salesTariffDescription;
+
+ /**
+ * Sales Tariff. Num E Price Levels. Counter
+ *
+ * The overall number of distinct price levels used across all provided SalesTariff elements.
+ */
+ @Nullable private Integer numEPriceLevels;
+
+ /** Sales Tariff Entry */
+ private SalesTariffEntry[] salesTariffEntry;
+
+ /**
+ * Constructor for the SalesTariff class
+ *
+ * @param id SalesTariff identifier used to identify one sales tariff. An SAID remains a unique
+ * identifier for one schedule throughout a charging session.
+ * @param salesTariffEntry Sales Tariff Entry
+ */
+ public SalesTariff(Integer id, SalesTariffEntry[] salesTariffEntry) {
+ setId(id);
+ setSalesTariffEntry(salesTariffEntry);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SalesTariff withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets salesTariff identifier used to identify one sales tariff. An SAID remains a unique
+ * identifier for one schedule throughout a charging session.
+ *
+ * @return SalesTariff identifier used to identify one sales tariff
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * Sets salesTariff identifier used to identify one sales tariff. An SAID remains a unique
+ * identifier for one schedule throughout a charging session.
+ *
+ * @param id SalesTariff identifier used to identify one sales tariff
+ */
+ public void setId(Integer id) {
+ if (!isValidId(id)) {
+ throw new PropertyConstraintException(id, "id is invalid");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Returns whether the given id is valid
+ *
+ * @param id the id to check the validity of
+ * @return {@code true} if id is valid, {@code false} if not
+ */
+ private boolean isValidId(Integer id) {
+ return id != null;
+ }
+
+ /**
+ * Gets a human readable title/short description of the sales tariff e.g. for HMI display
+ * purposes.
+ *
+ * @return A human readable title/short description of the sales tariff e.g. for HMI display
+ * purposes
+ */
+ @Nullable
+ public String getSalesTariffDescription() {
+ return salesTariffDescription;
+ }
+
+ /**
+ * Sets a human readable title/short description of the sales tariff e.g. for HMI display
+ * purposes.
+ *
+ * @param salesTariffDescription A human readable title/short description of the sales tariff e.g.
+ * for HMI display purposes
+ */
+ public void setSalesTariffDescription(@Nullable String salesTariffDescription) {
+ if (!isValidSalesTariffDescription(salesTariffDescription)) {
+ throw new PropertyConstraintException(
+ salesTariffDescription, "salesTariffDescription is invalid");
+ }
+ this.salesTariffDescription = salesTariffDescription;
+ }
+
+ /**
+ * Returns whether the given salesTariffDescription is valid
+ *
+ * @param salesTariffDescription the salesTariffDescription to check the validity of
+ * @return {@code true} if salesTariffDescription is valid, {@code false} if not
+ */
+ private boolean isValidSalesTariffDescription(@Nullable String salesTariffDescription) {
+ return salesTariffDescription == null || salesTariffDescription.length() <= 32;
+ }
+
+ /**
+ * Adds a human readable title/short description of the sales tariff e.g. for HMI display
+ * purposes.
+ *
+ * @param salesTariffDescription A human readable title/short description of the sales tariff e.g.
+ * for HMI display purposes
+ * @return this
+ */
+ public SalesTariff withSalesTariffDescription(@Nullable String salesTariffDescription) {
+ setSalesTariffDescription(salesTariffDescription);
+ return this;
+ }
+
+ /**
+ * Gets the overall number of distinct price levels used across all provided SalesTariff elements.
+ *
+ * @return The overall number of distinct price levels used across all provided SalesTariff
+ * elements
+ */
+ @Nullable
+ public Integer getNumEPriceLevels() {
+ return numEPriceLevels;
+ }
+
+ /**
+ * Sets the overall number of distinct price levels used across all provided SalesTariff elements.
+ *
+ * @param numEPriceLevels The overall number of distinct price levels used across all provided
+ * SalesTariff elements
+ */
+ public void setNumEPriceLevels(@Nullable Integer numEPriceLevels) {
+ this.numEPriceLevels = numEPriceLevels;
+ }
+
+ /**
+ * Adds the overall number of distinct price levels used across all provided SalesTariff elements.
+ *
+ * @param numEPriceLevels The overall number of distinct price levels used across all provided
+ * SalesTariff elements
+ * @return this
+ */
+ public SalesTariff withNumEPriceLevels(@Nullable Integer numEPriceLevels) {
+ setNumEPriceLevels(numEPriceLevels);
+ return this;
+ }
+
+ /**
+ * Gets sales Tariff Entry
+ *
+ * @return Sales Tariff Entry
+ */
+ public SalesTariffEntry[] getSalesTariffEntry() {
+ return salesTariffEntry;
+ }
+
+ /**
+ * Sets sales Tariff Entry
+ *
+ * @param salesTariffEntry Sales Tariff Entry
+ */
+ public void setSalesTariffEntry(SalesTariffEntry[] salesTariffEntry) {
+ if (!isValidSalesTariffEntry(salesTariffEntry)) {
+ throw new PropertyConstraintException(salesTariffEntry, "salesTariffEntry is invalid");
+ }
+ this.salesTariffEntry = salesTariffEntry;
+ }
+
+ /**
+ * Returns whether the given salesTariffEntry is valid
+ *
+ * @param salesTariffEntry the salesTariffEntry to check the validity of
+ * @return {@code true} if salesTariffEntry is valid, {@code false} if not
+ */
+ private boolean isValidSalesTariffEntry(SalesTariffEntry[] salesTariffEntry) {
+ return salesTariffEntry != null
+ && salesTariffEntry.length >= 1
+ && salesTariffEntry.length <= 1024
+ && Arrays.stream(salesTariffEntry).allMatch(item -> item.validate());
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidId(id)
+ && isValidSalesTariffDescription(salesTariffDescription)
+ && isValidSalesTariffEntry(salesTariffEntry);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SalesTariff that = (SalesTariff) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(id, that.id)
+ && Objects.equals(salesTariffDescription, that.salesTariffDescription)
+ && Objects.equals(numEPriceLevels, that.numEPriceLevels)
+ && Arrays.equals(salesTariffEntry, that.salesTariffEntry);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, id, salesTariffDescription, numEPriceLevels, Arrays.hashCode(salesTariffEntry));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("id", id)
+ .add("salesTariffDescription", salesTariffDescription)
+ .add("numEPriceLevels", numEPriceLevels)
+ .add("salesTariffEntry", salesTariffEntry)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SalesTariffEntry.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SalesTariffEntry.java
new file mode 100644
index 000000000..3e907abe5
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SalesTariffEntry.java
@@ -0,0 +1,270 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Sales Tariff Entry */
+public final class SalesTariffEntry {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Relative Timer Interval */
+ private RelativeTimeInterval relativeTimeInterval;
+
+ /**
+ * Sales Tariff Entry. E Price Level. Unsigned Integer
+ *
+ * The price level of this SalesTariffEntry (referring to NumEPriceLevels). Small values for
+ * the EPriceLevel represent a cheaper TariffEntry. Large values for the EPriceLevel represent a
+ * more expensive TariffEntry.
+ */
+ @Nullable private Integer ePriceLevel;
+
+ /** Consumption Cost */
+ @Nullable private ConsumptionCost[] consumptionCost;
+
+ /**
+ * Constructor for the SalesTariffEntry class
+ *
+ * @param relativeTimeInterval Relative Timer Interval
+ */
+ public SalesTariffEntry(RelativeTimeInterval relativeTimeInterval) {
+ setRelativeTimeInterval(relativeTimeInterval);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SalesTariffEntry withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets relative Timer Interval
+ *
+ * @return Relative Timer Interval
+ */
+ public RelativeTimeInterval getRelativeTimeInterval() {
+ return relativeTimeInterval;
+ }
+
+ /**
+ * Sets relative Timer Interval
+ *
+ * @param relativeTimeInterval Relative Timer Interval
+ */
+ public void setRelativeTimeInterval(RelativeTimeInterval relativeTimeInterval) {
+ if (!isValidRelativeTimeInterval(relativeTimeInterval)) {
+ throw new PropertyConstraintException(
+ relativeTimeInterval, "relativeTimeInterval is invalid");
+ }
+ this.relativeTimeInterval = relativeTimeInterval;
+ }
+
+ /**
+ * Returns whether the given relativeTimeInterval is valid
+ *
+ * @param relativeTimeInterval the relativeTimeInterval to check the validity of
+ * @return {@code true} if relativeTimeInterval is valid, {@code false} if not
+ */
+ private boolean isValidRelativeTimeInterval(RelativeTimeInterval relativeTimeInterval) {
+ return relativeTimeInterval != null && relativeTimeInterval.validate();
+ }
+
+ /**
+ * Gets the price level of this SalesTariffEntry (referring to NumEPriceLevels). Small values for
+ * the EPriceLevel represent a cheaper TariffEntry. Large values for the EPriceLevel represent a
+ * more expensive TariffEntry.
+ *
+ * @return The price level of this SalesTariffEntry (referring to NumEPriceLevels)
+ */
+ @Nullable
+ public Integer getEPriceLevel() {
+ return ePriceLevel;
+ }
+
+ /**
+ * Sets the price level of this SalesTariffEntry (referring to NumEPriceLevels). Small values for
+ * the EPriceLevel represent a cheaper TariffEntry. Large values for the EPriceLevel represent a
+ * more expensive TariffEntry.
+ *
+ * @param ePriceLevel The price level of this SalesTariffEntry (referring to NumEPriceLevels)
+ */
+ public void setEPriceLevel(@Nullable Integer ePriceLevel) {
+ if (!isValidEPriceLevel(ePriceLevel)) {
+ throw new PropertyConstraintException(ePriceLevel, "ePriceLevel is invalid");
+ }
+ this.ePriceLevel = ePriceLevel;
+ }
+
+ /**
+ * Returns whether the given ePriceLevel is valid
+ *
+ * @param ePriceLevel the ePriceLevel to check the validity of
+ * @return {@code true} if ePriceLevel is valid, {@code false} if not
+ */
+ private boolean isValidEPriceLevel(@Nullable Integer ePriceLevel) {
+ return ePriceLevel == null || (ePriceLevel >= 0);
+ }
+
+ /**
+ * Adds the price level of this SalesTariffEntry (referring to NumEPriceLevels). Small values for
+ * the EPriceLevel represent a cheaper TariffEntry. Large values for the EPriceLevel represent a
+ * more expensive TariffEntry.
+ *
+ * @param ePriceLevel The price level of this SalesTariffEntry (referring to NumEPriceLevels)
+ * @return this
+ */
+ public SalesTariffEntry withEPriceLevel(@Nullable Integer ePriceLevel) {
+ setEPriceLevel(ePriceLevel);
+ return this;
+ }
+
+ /**
+ * Gets consumption Cost
+ *
+ * @return Consumption Cost
+ */
+ @Nullable
+ public ConsumptionCost[] getConsumptionCost() {
+ return consumptionCost;
+ }
+
+ /**
+ * Sets consumption Cost
+ *
+ * @param consumptionCost Consumption Cost
+ */
+ public void setConsumptionCost(@Nullable ConsumptionCost[] consumptionCost) {
+ if (!isValidConsumptionCost(consumptionCost)) {
+ throw new PropertyConstraintException(consumptionCost, "consumptionCost is invalid");
+ }
+ this.consumptionCost = consumptionCost;
+ }
+
+ /**
+ * Returns whether the given consumptionCost is valid
+ *
+ * @param consumptionCost the consumptionCost to check the validity of
+ * @return {@code true} if consumptionCost is valid, {@code false} if not
+ */
+ private boolean isValidConsumptionCost(@Nullable ConsumptionCost[] consumptionCost) {
+ return consumptionCost == null
+ || (consumptionCost.length >= 1
+ && consumptionCost.length <= 3
+ && Arrays.stream(consumptionCost).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds consumption Cost
+ *
+ * @param consumptionCost Consumption Cost
+ * @return this
+ */
+ public SalesTariffEntry withConsumptionCost(@Nullable ConsumptionCost[] consumptionCost) {
+ setConsumptionCost(consumptionCost);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidRelativeTimeInterval(relativeTimeInterval)
+ && isValidEPriceLevel(ePriceLevel)
+ && isValidConsumptionCost(consumptionCost);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SalesTariffEntry that = (SalesTariffEntry) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(relativeTimeInterval, that.relativeTimeInterval)
+ && Objects.equals(ePriceLevel, that.ePriceLevel)
+ && Arrays.equals(consumptionCost, that.consumptionCost);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, relativeTimeInterval, ePriceLevel, Arrays.hashCode(consumptionCost));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("relativeTimeInterval", relativeTimeInterval)
+ .add("ePriceLevel", ePriceLevel)
+ .add("consumptionCost", consumptionCost)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SampledValue.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SampledValue.java
new file mode 100644
index 000000000..03d38f6f1
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SampledValue.java
@@ -0,0 +1,426 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * Sampled Value
+ *
+ * Single sampled value in MeterValues. Each value can be accompanied by optional fields.
+ *
+ * To save on mobile data usage, default values of all of the optional fields are such that. The
+ * value without any additional fields will be interpreted, as a register reading of active import
+ * energy in Wh (Watt-hour) units.
+ */
+public final class SampledValue {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Sampled Value. Value. Measure
+ *
+ * The measured value.
+ */
+ private Double value;
+
+ /**
+ * Sampled Value. Context. Reading Context Code
+ *
+ * Type of detail value: start, end or sample. Default = "Sample.Periodic"
+ */
+ @Nullable private ReadingContextEnum context;
+
+ /**
+ * Sampled Value. Measurand. Measurand Code
+ *
+ * Type of measurement. Default = "Energy.Active.Import.Register"
+ */
+ @Nullable private MeasurandEnum measurand;
+
+ /**
+ * Sampled Value. Phase. Phase Code
+ *
+ * How the measured value is to be interpreted. For instance between L1 and neutral (L1-N)
+ * Please note that not all values of phase are applicable to all Measurands. When phase is
+ * absent, the measured value is interpreted as an overall value.
+ */
+ @Nullable private PhaseEnum phase;
+
+ /**
+ * Sampled Value. Location. Location Code
+ *
+ * Where the measured value has been sampled. Default = "Outlet"
+ */
+ @Nullable private LocationEnum location;
+
+ /** A signed version of the meter value. */
+ @Nullable private SignedMeterValue signedMeterValue;
+
+ /** A UnitOfMeasure with a multiplier */
+ @Nullable private UnitOfMeasure unitOfMeasure;
+
+ /**
+ * Constructor for the SampledValue class
+ *
+ * @param value The measured value.
+ */
+ public SampledValue(Double value) {
+ setValue(value);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SampledValue withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the measured value.
+ *
+ * @return The measured value
+ */
+ public Double getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the measured value.
+ *
+ * @param value The measured value
+ */
+ public void setValue(Double value) {
+ if (!isValidValue(value)) {
+ throw new PropertyConstraintException(value, "value is invalid");
+ }
+ this.value = value;
+ }
+
+ /**
+ * Returns whether the given value is valid
+ *
+ * @param value the value to check the validity of
+ * @return {@code true} if value is valid, {@code false} if not
+ */
+ private boolean isValidValue(Double value) {
+ return value != null;
+ }
+
+ /**
+ * Gets type of detail value: start, end or sample. Default = "Sample.Periodic"
+ *
+ * @return Type of detail value: start, end or sample
+ */
+ public ReadingContextEnum getContext() {
+ return context != null ? context : ReadingContextEnum.SamplePeriodic;
+ }
+
+ /**
+ * Sets type of detail value: start, end or sample. Default = "Sample.Periodic"
+ *
+ * @param context Type of detail value: start, end or sample
+ */
+ public void setContext(@Nullable ReadingContextEnum context) {
+ this.context = context;
+ }
+
+ /**
+ * Adds type of detail value: start, end or sample. Default = "Sample.Periodic"
+ *
+ * @param context Type of detail value: start, end or sample
+ * @return this
+ */
+ public SampledValue withContext(@Nullable ReadingContextEnum context) {
+ setContext(context);
+ return this;
+ }
+
+ /**
+ * Gets type of measurement. Default = "Energy.Active.Import.Register"
+ *
+ * @return Type of measurement
+ */
+ public MeasurandEnum getMeasurand() {
+ return measurand != null ? measurand : MeasurandEnum.EnergyActiveImportRegister;
+ }
+
+ /**
+ * Sets type of measurement. Default = "Energy.Active.Import.Register"
+ *
+ * @param measurand Type of measurement
+ */
+ public void setMeasurand(@Nullable MeasurandEnum measurand) {
+ this.measurand = measurand;
+ }
+
+ /**
+ * Adds type of measurement. Default = "Energy.Active.Import.Register"
+ *
+ * @param measurand Type of measurement
+ * @return this
+ */
+ public SampledValue withMeasurand(@Nullable MeasurandEnum measurand) {
+ setMeasurand(measurand);
+ return this;
+ }
+
+ /**
+ * Gets how the measured value is to be interpreted. For instance between L1 and neutral (L1-N)
+ * Please note that not all values of phase are applicable to all Measurands. When phase is
+ * absent, the measured value is interpreted as an overall value.
+ *
+ * @return How the measured value is to be interpreted
+ */
+ @Nullable
+ public PhaseEnum getPhase() {
+ return phase;
+ }
+
+ /**
+ * Sets how the measured value is to be interpreted. For instance between L1 and neutral (L1-N)
+ * Please note that not all values of phase are applicable to all Measurands. When phase is
+ * absent, the measured value is interpreted as an overall value.
+ *
+ * @param phase How the measured value is to be interpreted
+ */
+ public void setPhase(@Nullable PhaseEnum phase) {
+ this.phase = phase;
+ }
+
+ /**
+ * Adds how the measured value is to be interpreted. For instance between L1 and neutral (L1-N)
+ * Please note that not all values of phase are applicable to all Measurands. When phase is
+ * absent, the measured value is interpreted as an overall value.
+ *
+ * @param phase How the measured value is to be interpreted
+ * @return this
+ */
+ public SampledValue withPhase(@Nullable PhaseEnum phase) {
+ setPhase(phase);
+ return this;
+ }
+
+ /**
+ * Gets where the measured value has been sampled. Default = "Outlet"
+ *
+ * @return Where the measured value has been sampled
+ */
+ public LocationEnum getLocation() {
+ return location != null ? location : LocationEnum.Outlet;
+ }
+
+ /**
+ * Sets where the measured value has been sampled. Default = "Outlet"
+ *
+ * @param location Where the measured value has been sampled
+ */
+ public void setLocation(@Nullable LocationEnum location) {
+ this.location = location;
+ }
+
+ /**
+ * Adds where the measured value has been sampled. Default = "Outlet"
+ *
+ * @param location Where the measured value has been sampled
+ * @return this
+ */
+ public SampledValue withLocation(@Nullable LocationEnum location) {
+ setLocation(location);
+ return this;
+ }
+
+ /**
+ * Gets a signed version of the meter value.
+ *
+ * @return A signed version of the meter value
+ */
+ @Nullable
+ public SignedMeterValue getSignedMeterValue() {
+ return signedMeterValue;
+ }
+
+ /**
+ * Sets a signed version of the meter value.
+ *
+ * @param signedMeterValue A signed version of the meter value
+ */
+ public void setSignedMeterValue(@Nullable SignedMeterValue signedMeterValue) {
+ if (!isValidSignedMeterValue(signedMeterValue)) {
+ throw new PropertyConstraintException(signedMeterValue, "signedMeterValue is invalid");
+ }
+ this.signedMeterValue = signedMeterValue;
+ }
+
+ /**
+ * Returns whether the given signedMeterValue is valid
+ *
+ * @param signedMeterValue the signedMeterValue to check the validity of
+ * @return {@code true} if signedMeterValue is valid, {@code false} if not
+ */
+ private boolean isValidSignedMeterValue(@Nullable SignedMeterValue signedMeterValue) {
+ return signedMeterValue == null || signedMeterValue.validate();
+ }
+
+ /**
+ * Adds a signed version of the meter value.
+ *
+ * @param signedMeterValue A signed version of the meter value
+ * @return this
+ */
+ public SampledValue withSignedMeterValue(@Nullable SignedMeterValue signedMeterValue) {
+ setSignedMeterValue(signedMeterValue);
+ return this;
+ }
+
+ /**
+ * Gets a UnitOfMeasure with a multiplier
+ *
+ * @return A UnitOfMeasure with a multiplier
+ */
+ @Nullable
+ public UnitOfMeasure getUnitOfMeasure() {
+ return unitOfMeasure;
+ }
+
+ /**
+ * Sets a UnitOfMeasure with a multiplier
+ *
+ * @param unitOfMeasure A UnitOfMeasure with a multiplier
+ */
+ public void setUnitOfMeasure(@Nullable UnitOfMeasure unitOfMeasure) {
+ if (!isValidUnitOfMeasure(unitOfMeasure)) {
+ throw new PropertyConstraintException(unitOfMeasure, "unitOfMeasure is invalid");
+ }
+ this.unitOfMeasure = unitOfMeasure;
+ }
+
+ /**
+ * Returns whether the given unitOfMeasure is valid
+ *
+ * @param unitOfMeasure the unitOfMeasure to check the validity of
+ * @return {@code true} if unitOfMeasure is valid, {@code false} if not
+ */
+ private boolean isValidUnitOfMeasure(@Nullable UnitOfMeasure unitOfMeasure) {
+ return unitOfMeasure == null || unitOfMeasure.validate();
+ }
+
+ /**
+ * Adds a UnitOfMeasure with a multiplier
+ *
+ * @param unitOfMeasure A UnitOfMeasure with a multiplier
+ * @return this
+ */
+ public SampledValue withUnitOfMeasure(@Nullable UnitOfMeasure unitOfMeasure) {
+ setUnitOfMeasure(unitOfMeasure);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidValue(value)
+ && isValidSignedMeterValue(signedMeterValue)
+ && isValidUnitOfMeasure(unitOfMeasure);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SampledValue that = (SampledValue) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(value, that.value)
+ && Objects.equals(context, that.context)
+ && Objects.equals(measurand, that.measurand)
+ && Objects.equals(phase, that.phase)
+ && Objects.equals(location, that.location)
+ && Objects.equals(signedMeterValue, that.signedMeterValue)
+ && Objects.equals(unitOfMeasure, that.unitOfMeasure);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, value, context, measurand, phase, location, signedMeterValue, unitOfMeasure);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("value", value)
+ .add("context", context)
+ .add("measurand", measurand)
+ .add("phase", phase)
+ .add("location", location)
+ .add("signedMeterValue", signedMeterValue)
+ .add("unitOfMeasure", unitOfMeasure)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SendLocalListStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SendLocalListStatusEnum.java
new file mode 100644
index 000000000..6c762bb54
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SendLocalListStatusEnum.java
@@ -0,0 +1,35 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Whether the Charging Station has successfully received and applied the update of the Local
+ * Authorization List.
+ */
+public enum SendLocalListStatusEnum {
+ Accepted,
+ Failed,
+ VersionMismatch
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetMonitoringData.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetMonitoringData.java
new file mode 100644
index 000000000..e78ee5b3d
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetMonitoringData.java
@@ -0,0 +1,433 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Class to hold parameters of SetVariableMonitoring request. */
+public final class SetMonitoringData {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * An id SHALL only be given to replace an existing monitor. The Charging Station handles the
+ * generation of id's for new monitors.
+ */
+ @Nullable private Integer id;
+
+ /**
+ * Monitor only active when a transaction is ongoing on a component relevant to this transaction.
+ * Default = false.
+ */
+ @Nullable private Boolean transaction;
+
+ /**
+ * Value for threshold or delta monitoring. For Periodic or PeriodicClockAligned this is the
+ * interval in seconds.
+ */
+ private Double value;
+
+ /** The type of this monitor, e.g. a threshold, delta or periodic monitor. */
+ private MonitorEnum type;
+
+ /**
+ * The severity that will be assigned to an event that is triggered by this monitor. The severity
+ * range is 0-9, with 0 as the highest and 9 as the lowest severity level.
+ *
+ * The Configuration Variable ConfigurationValueSize can be used to limit
+ * SetVariableData.attributeValue and VariableCharacteristics.valueList. The max size of these
+ * values will always remain equal.
+ */
+ private String attributeValue;
+
+ /** A physical or logical component */
+ private Component component;
+
+ /** Reference key to a component-variable. */
+ private Variable variable;
+
+ /**
+ * Constructor for the SetVariableData class
+ *
+ * @param attributeValue Value to be assigned to attribute of variable.
+ * @param component A physical or logical component
+ * @param variable Reference key to a component-variable.
+ */
+ public SetVariableData(String attributeValue, Component component, Variable variable) {
+ setAttributeValue(attributeValue);
+ setComponent(component);
+ setVariable(variable);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetVariableData withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted.
+ *
+ * @return Type of attribute: Actual, Target, MinSet, MaxSet
+ */
+ public AttributeEnum getAttributeType() {
+ return attributeType != null ? attributeType : AttributeEnum.Actual;
+ }
+
+ /**
+ * Sets type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted.
+ *
+ * @param attributeType Type of attribute: Actual, Target, MinSet, MaxSet
+ */
+ public void setAttributeType(@Nullable AttributeEnum attributeType) {
+ this.attributeType = attributeType;
+ }
+
+ /**
+ * Adds type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted.
+ *
+ * @param attributeType Type of attribute: Actual, Target, MinSet, MaxSet
+ * @return this
+ */
+ public SetVariableData withAttributeType(@Nullable AttributeEnum attributeType) {
+ setAttributeType(attributeType);
+ return this;
+ }
+
+ /**
+ * Gets value to be assigned to attribute of variable.
+ *
+ * @return Value to be assigned to attribute of variable
+ */
+ public String getAttributeValue() {
+ return attributeValue;
+ }
+
+ /**
+ * Sets value to be assigned to attribute of variable.
+ *
+ * @param attributeValue Value to be assigned to attribute of variable
+ */
+ public void setAttributeValue(String attributeValue) {
+ if (!isValidAttributeValue(attributeValue)) {
+ throw new PropertyConstraintException(attributeValue, "attributeValue is invalid");
+ }
+ this.attributeValue = attributeValue;
+ }
+
+ /**
+ * Returns whether the given attributeValue is valid
+ *
+ * @param attributeValue the attributeValue to check the validity of
+ * @return {@code true} if attributeValue is valid, {@code false} if not
+ */
+ private boolean isValidAttributeValue(String attributeValue) {
+ return attributeValue != null && attributeValue.length() <= 1000;
+ }
+
+ /**
+ * Gets a physical or logical component
+ *
+ * @return A physical or logical component
+ */
+ public Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets a physical or logical component
+ *
+ * @param component A physical or logical component
+ */
+ public void setComponent(Component component) {
+ if (!isValidComponent(component)) {
+ throw new PropertyConstraintException(component, "component is invalid");
+ }
+ this.component = component;
+ }
+
+ /**
+ * Returns whether the given component is valid
+ *
+ * @param component the component to check the validity of
+ * @return {@code true} if component is valid, {@code false} if not
+ */
+ private boolean isValidComponent(Component component) {
+ return component != null && component.validate();
+ }
+
+ /**
+ * Gets reference key to a component-variable.
+ *
+ * @return Reference key to a component-variable
+ */
+ public Variable getVariable() {
+ return variable;
+ }
+
+ /**
+ * Sets reference key to a component-variable.
+ *
+ * @param variable Reference key to a component-variable
+ */
+ public void setVariable(Variable variable) {
+ if (!isValidVariable(variable)) {
+ throw new PropertyConstraintException(variable, "variable is invalid");
+ }
+ this.variable = variable;
+ }
+
+ /**
+ * Returns whether the given variable is valid
+ *
+ * @param variable the variable to check the validity of
+ * @return {@code true} if variable is valid, {@code false} if not
+ */
+ private boolean isValidVariable(Variable variable) {
+ return variable != null && variable.validate();
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidAttributeValue(attributeValue)
+ && isValidComponent(component)
+ && isValidVariable(variable);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetVariableData that = (SetVariableData) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(attributeType, that.attributeType)
+ && Objects.equals(attributeValue, that.attributeValue)
+ && Objects.equals(component, that.component)
+ && Objects.equals(variable, that.variable);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, attributeType, attributeValue, component, variable);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("attributeType", attributeType)
+ .add("attributeValue", attributeValue)
+ .add("component", component)
+ .add("variable", variable)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetVariableResult.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetVariableResult.java
new file mode 100644
index 000000000..7e4ca21f1
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetVariableResult.java
@@ -0,0 +1,317 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** SetVariableResultType */
+public final class SetVariableResult {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted. */
+ @Nullable private AttributeEnum attributeType;
+
+ /** Result status of setting the variable. */
+ private SetVariableStatusEnum attributeStatus;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo attributeStatusInfo;
+
+ /** A physical or logical component */
+ private Component component;
+
+ /** Reference key to a component-variable. */
+ private Variable variable;
+
+ /**
+ * Constructor for the SetVariableResult class
+ *
+ * @param attributeStatus Result status of setting the variable.
+ * @param component A physical or logical component
+ * @param variable Reference key to a component-variable.
+ */
+ public SetVariableResult(
+ SetVariableStatusEnum attributeStatus, Component component, Variable variable) {
+ setAttributeStatus(attributeStatus);
+ setComponent(component);
+ setVariable(variable);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetVariableResult withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted.
+ *
+ * @return Type of attribute: Actual, Target, MinSet, MaxSet
+ */
+ public AttributeEnum getAttributeType() {
+ return attributeType != null ? attributeType : AttributeEnum.Actual;
+ }
+
+ /**
+ * Sets type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted.
+ *
+ * @param attributeType Type of attribute: Actual, Target, MinSet, MaxSet
+ */
+ public void setAttributeType(@Nullable AttributeEnum attributeType) {
+ this.attributeType = attributeType;
+ }
+
+ /**
+ * Adds type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted.
+ *
+ * @param attributeType Type of attribute: Actual, Target, MinSet, MaxSet
+ * @return this
+ */
+ public SetVariableResult withAttributeType(@Nullable AttributeEnum attributeType) {
+ setAttributeType(attributeType);
+ return this;
+ }
+
+ /**
+ * Gets result status of setting the variable.
+ *
+ * @return Result status of setting the variable
+ */
+ public SetVariableStatusEnum getAttributeStatus() {
+ return attributeStatus;
+ }
+
+ /**
+ * Sets result status of setting the variable.
+ *
+ * @param attributeStatus Result status of setting the variable
+ */
+ public void setAttributeStatus(SetVariableStatusEnum attributeStatus) {
+ if (!isValidAttributeStatus(attributeStatus)) {
+ throw new PropertyConstraintException(attributeStatus, "attributeStatus is invalid");
+ }
+ this.attributeStatus = attributeStatus;
+ }
+
+ /**
+ * Returns whether the given attributeStatus is valid
+ *
+ * @param attributeStatus the attributeStatus to check the validity of
+ * @return {@code true} if attributeStatus is valid, {@code false} if not
+ */
+ private boolean isValidAttributeStatus(SetVariableStatusEnum attributeStatus) {
+ return attributeStatus != null;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getAttributeStatusInfo() {
+ return attributeStatusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param attributeStatusInfo More information about the status
+ */
+ public void setAttributeStatusInfo(@Nullable StatusInfo attributeStatusInfo) {
+ if (!isValidAttributeStatusInfo(attributeStatusInfo)) {
+ throw new PropertyConstraintException(attributeStatusInfo, "attributeStatusInfo is invalid");
+ }
+ this.attributeStatusInfo = attributeStatusInfo;
+ }
+
+ /**
+ * Returns whether the given attributeStatusInfo is valid
+ *
+ * @param attributeStatusInfo the attributeStatusInfo to check the validity of
+ * @return {@code true} if attributeStatusInfo is valid, {@code false} if not
+ */
+ private boolean isValidAttributeStatusInfo(@Nullable StatusInfo attributeStatusInfo) {
+ return attributeStatusInfo == null || attributeStatusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param attributeStatusInfo More information about the status
+ * @return this
+ */
+ public SetVariableResult withAttributeStatusInfo(@Nullable StatusInfo attributeStatusInfo) {
+ setAttributeStatusInfo(attributeStatusInfo);
+ return this;
+ }
+
+ /**
+ * Gets a physical or logical component
+ *
+ * @return A physical or logical component
+ */
+ public Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets a physical or logical component
+ *
+ * @param component A physical or logical component
+ */
+ public void setComponent(Component component) {
+ if (!isValidComponent(component)) {
+ throw new PropertyConstraintException(component, "component is invalid");
+ }
+ this.component = component;
+ }
+
+ /**
+ * Returns whether the given component is valid
+ *
+ * @param component the component to check the validity of
+ * @return {@code true} if component is valid, {@code false} if not
+ */
+ private boolean isValidComponent(Component component) {
+ return component != null && component.validate();
+ }
+
+ /**
+ * Gets reference key to a component-variable.
+ *
+ * @return Reference key to a component-variable
+ */
+ public Variable getVariable() {
+ return variable;
+ }
+
+ /**
+ * Sets reference key to a component-variable.
+ *
+ * @param variable Reference key to a component-variable
+ */
+ public void setVariable(Variable variable) {
+ if (!isValidVariable(variable)) {
+ throw new PropertyConstraintException(variable, "variable is invalid");
+ }
+ this.variable = variable;
+ }
+
+ /**
+ * Returns whether the given variable is valid
+ *
+ * @param variable the variable to check the validity of
+ * @return {@code true} if variable is valid, {@code false} if not
+ */
+ private boolean isValidVariable(Variable variable) {
+ return variable != null && variable.validate();
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidAttributeStatus(attributeStatus)
+ && isValidAttributeStatusInfo(attributeStatusInfo)
+ && isValidComponent(component)
+ && isValidVariable(variable);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetVariableResult that = (SetVariableResult) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(attributeType, that.attributeType)
+ && Objects.equals(attributeStatus, that.attributeStatus)
+ && Objects.equals(attributeStatusInfo, that.attributeStatusInfo)
+ && Objects.equals(component, that.component)
+ && Objects.equals(variable, that.variable);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, attributeType, attributeStatus, attributeStatusInfo, component, variable);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("attributeType", attributeType)
+ .add("attributeStatus", attributeStatus)
+ .add("attributeStatusInfo", attributeStatusInfo)
+ .add("component", component)
+ .add("variable", variable)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetVariableStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetVariableStatusEnum.java
new file mode 100644
index 000000000..e8647b21b
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetVariableStatusEnum.java
@@ -0,0 +1,35 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Result status of setting the variable. */
+public enum SetVariableStatusEnum {
+ Accepted,
+ Rejected,
+ UnknownComponent,
+ UnknownVariable,
+ NotSupportedAttributeType,
+ RebootRequired
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SignedMeterValue.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SignedMeterValue.java
new file mode 100644
index 000000000..bf0b35d40
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SignedMeterValue.java
@@ -0,0 +1,285 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** A signed version of the meter value. */
+public final class SignedMeterValue {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Base64 encoded, contains the signed data which might contain more then just the meter value. It
+ * can contain information like timestamps, reference to a customer etc.
+ */
+ private String signedMeterData;
+
+ /** Method used to create the digital signature. */
+ private String signingMethod;
+
+ /** Method used to encode the meter values before applying the digital signature algorithm. */
+ private String encodingMethod;
+
+ /** Base64 encoded, sending depends on configuration variable PublicKeyWithSignedMeterValue. */
+ private String publicKey;
+
+ /**
+ * Constructor for the SignedMeterValue class
+ *
+ * @param signedMeterData Base64 encoded, contains the signed data which might contain more then
+ * just the meter value. It can contain information like timestamps, reference to a customer
+ * etc.
+ * @param signingMethod Method used to create the digital signature.
+ * @param encodingMethod Method used to encode the meter values before applying the digital
+ * signature algorithm.
+ * @param publicKey Base64 encoded, sending depends on configuration variable
+ * PublicKeyWithSignedMeterValue.
+ */
+ public SignedMeterValue(
+ String signedMeterData, String signingMethod, String encodingMethod, String publicKey) {
+ setSignedMeterData(signedMeterData);
+ setSigningMethod(signingMethod);
+ setEncodingMethod(encodingMethod);
+ setPublicKey(publicKey);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SignedMeterValue withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets base64 encoded, contains the signed data which might contain more then just the meter
+ * value. It can contain information like timestamps, reference to a customer etc.
+ *
+ * @return Base64 encoded, contains the signed data which might contain more then just the meter
+ * value
+ */
+ public String getSignedMeterData() {
+ return signedMeterData;
+ }
+
+ /**
+ * Sets base64 encoded, contains the signed data which might contain more then just the meter
+ * value. It can contain information like timestamps, reference to a customer etc.
+ *
+ * @param signedMeterData Base64 encoded, contains the signed data which might contain more then
+ * just the meter value
+ */
+ public void setSignedMeterData(String signedMeterData) {
+ if (!isValidSignedMeterData(signedMeterData)) {
+ throw new PropertyConstraintException(signedMeterData, "signedMeterData is invalid");
+ }
+ this.signedMeterData = signedMeterData;
+ }
+
+ /**
+ * Returns whether the given signedMeterData is valid
+ *
+ * @param signedMeterData the signedMeterData to check the validity of
+ * @return {@code true} if signedMeterData is valid, {@code false} if not
+ */
+ private boolean isValidSignedMeterData(String signedMeterData) {
+ return signedMeterData != null && signedMeterData.length() <= 2500;
+ }
+
+ /**
+ * Gets method used to create the digital signature.
+ *
+ * @return Method used to create the digital signature
+ */
+ public String getSigningMethod() {
+ return signingMethod;
+ }
+
+ /**
+ * Sets method used to create the digital signature.
+ *
+ * @param signingMethod Method used to create the digital signature
+ */
+ public void setSigningMethod(String signingMethod) {
+ if (!isValidSigningMethod(signingMethod)) {
+ throw new PropertyConstraintException(signingMethod, "signingMethod is invalid");
+ }
+ this.signingMethod = signingMethod;
+ }
+
+ /**
+ * Returns whether the given signingMethod is valid
+ *
+ * @param signingMethod the signingMethod to check the validity of
+ * @return {@code true} if signingMethod is valid, {@code false} if not
+ */
+ private boolean isValidSigningMethod(String signingMethod) {
+ return signingMethod != null && signingMethod.length() <= 50;
+ }
+
+ /**
+ * Gets method used to encode the meter values before applying the digital signature algorithm.
+ *
+ * @return Method used to encode the meter values before applying the digital signature algorithm
+ */
+ public String getEncodingMethod() {
+ return encodingMethod;
+ }
+
+ /**
+ * Sets method used to encode the meter values before applying the digital signature algorithm.
+ *
+ * @param encodingMethod Method used to encode the meter values before applying the digital
+ * signature algorithm
+ */
+ public void setEncodingMethod(String encodingMethod) {
+ if (!isValidEncodingMethod(encodingMethod)) {
+ throw new PropertyConstraintException(encodingMethod, "encodingMethod is invalid");
+ }
+ this.encodingMethod = encodingMethod;
+ }
+
+ /**
+ * Returns whether the given encodingMethod is valid
+ *
+ * @param encodingMethod the encodingMethod to check the validity of
+ * @return {@code true} if encodingMethod is valid, {@code false} if not
+ */
+ private boolean isValidEncodingMethod(String encodingMethod) {
+ return encodingMethod != null && encodingMethod.length() <= 50;
+ }
+
+ /**
+ * Gets base64 encoded, sending depends on configuration variable PublicKeyWithSignedMeterValue.
+ *
+ * @return Base64 encoded, sending depends on configuration variable PublicKeyWithSignedMeterValue
+ */
+ public String getPublicKey() {
+ return publicKey;
+ }
+
+ /**
+ * Sets base64 encoded, sending depends on configuration variable PublicKeyWithSignedMeterValue.
+ *
+ * @param publicKey Base64 encoded, sending depends on configuration variable
+ * PublicKeyWithSignedMeterValue
+ */
+ public void setPublicKey(String publicKey) {
+ if (!isValidPublicKey(publicKey)) {
+ throw new PropertyConstraintException(publicKey, "publicKey is invalid");
+ }
+ this.publicKey = publicKey;
+ }
+
+ /**
+ * Returns whether the given publicKey is valid
+ *
+ * @param publicKey the publicKey to check the validity of
+ * @return {@code true} if publicKey is valid, {@code false} if not
+ */
+ private boolean isValidPublicKey(String publicKey) {
+ return publicKey != null && publicKey.length() <= 2500;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidSignedMeterData(signedMeterData)
+ && isValidSigningMethod(signingMethod)
+ && isValidEncodingMethod(encodingMethod)
+ && isValidPublicKey(publicKey);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SignedMeterValue that = (SignedMeterValue) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(signedMeterData, that.signedMeterData)
+ && Objects.equals(signingMethod, that.signingMethod)
+ && Objects.equals(encodingMethod, that.encodingMethod)
+ && Objects.equals(publicKey, that.publicKey);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, signedMeterData, signingMethod, encodingMethod, publicKey);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("signedMeterData", signedMeterData)
+ .add("signingMethod", signingMethod)
+ .add("encodingMethod", encodingMethod)
+ .add("publicKey", publicKey)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/StatusInfo.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/StatusInfo.java
new file mode 100644
index 000000000..7fca651f1
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/StatusInfo.java
@@ -0,0 +1,209 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** More information about the status. */
+public final class StatusInfo {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * A predefined code for the reason why the status is returned in this response. The string is
+ * case-insensitive.
+ */
+ private String reasonCode;
+
+ /** Additional text to provide detailed information. */
+ @Nullable private String additionalInfo;
+
+ /**
+ * Constructor for the StatusInfo class
+ *
+ * @param reasonCode A predefined code for the reason why the status is returned in this response.
+ * The string is case-insensitive.
+ */
+ public StatusInfo(String reasonCode) {
+ setReasonCode(reasonCode);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public StatusInfo withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets a predefined code for the reason why the status is returned in this response. The string
+ * is case-insensitive.
+ *
+ * @return A predefined code for the reason why the status is returned in this response
+ */
+ public String getReasonCode() {
+ return reasonCode;
+ }
+
+ /**
+ * Sets a predefined code for the reason why the status is returned in this response. The string
+ * is case-insensitive.
+ *
+ * @param reasonCode A predefined code for the reason why the status is returned in this response
+ */
+ public void setReasonCode(String reasonCode) {
+ if (!isValidReasonCode(reasonCode)) {
+ throw new PropertyConstraintException(reasonCode, "reasonCode is invalid");
+ }
+ this.reasonCode = reasonCode;
+ }
+
+ /**
+ * Returns whether the given reasonCode is valid
+ *
+ * @param reasonCode the reasonCode to check the validity of
+ * @return {@code true} if reasonCode is valid, {@code false} if not
+ */
+ private boolean isValidReasonCode(String reasonCode) {
+ return reasonCode != null && reasonCode.length() <= 20;
+ }
+
+ /**
+ * Gets additional text to provide detailed information.
+ *
+ * @return Additional text to provide detailed information
+ */
+ @Nullable
+ public String getAdditionalInfo() {
+ return additionalInfo;
+ }
+
+ /**
+ * Sets additional text to provide detailed information.
+ *
+ * @param additionalInfo Additional text to provide detailed information
+ */
+ public void setAdditionalInfo(@Nullable String additionalInfo) {
+ if (!isValidAdditionalInfo(additionalInfo)) {
+ throw new PropertyConstraintException(additionalInfo, "additionalInfo is invalid");
+ }
+ this.additionalInfo = additionalInfo;
+ }
+
+ /**
+ * Returns whether the given additionalInfo is valid
+ *
+ * @param additionalInfo the additionalInfo to check the validity of
+ * @return {@code true} if additionalInfo is valid, {@code false} if not
+ */
+ private boolean isValidAdditionalInfo(@Nullable String additionalInfo) {
+ return additionalInfo == null || additionalInfo.length() <= 512;
+ }
+
+ /**
+ * Adds additional text to provide detailed information.
+ *
+ * @param additionalInfo Additional text to provide detailed information
+ * @return this
+ */
+ public StatusInfo withAdditionalInfo(@Nullable String additionalInfo) {
+ setAdditionalInfo(additionalInfo);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidReasonCode(reasonCode)
+ && isValidAdditionalInfo(additionalInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ StatusInfo that = (StatusInfo) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(reasonCode, that.reasonCode)
+ && Objects.equals(additionalInfo, that.additionalInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, reasonCode, additionalInfo);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("reasonCode", reasonCode)
+ .add("additionalInfo", additionalInfo)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Transaction.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Transaction.java
new file mode 100644
index 000000000..3510ee467
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Transaction.java
@@ -0,0 +1,318 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Transaction */
+public final class Transaction {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The Id of the transaction. */
+ private String transactionId;
+
+ /**
+ * Transaction. State. Transaction State Code
+ *
+ * Current charging state, is required when state has changed.
+ */
+ @Nullable private ChargingStateEnum chargingState;
+
+ /**
+ * Transaction. Time Spent Charging. Elapsed Time
+ *
+ * The total time that energy flowed from EVSE to EV during the transaction (in seconds). Note
+ * that timeSpentCharging is smaller or equal to the duration of the transaction.
+ */
+ @Nullable private Integer timeSpentCharging;
+
+ /**
+ * Transaction. Stopped Reason. EOT Reason Code
+ *
+ * The reason why the transaction was stopped. MAY only be omitted when Reason is "Local".
+ */
+ @Nullable private ReasonEnum stoppedReason;
+
+ /**
+ * The ID given to remote start request (RequestStartTransactionRequest. This enables to CSMS to
+ * match the started transaction to the given start request.
+ */
+ @Nullable private Integer remoteStartId;
+
+ /**
+ * Constructor for the Transaction class
+ *
+ * @param transactionId The Id of the transaction.
+ */
+ public Transaction(String transactionId) {
+ setTransactionId(transactionId);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public Transaction withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the Id of the transaction.
+ *
+ * @return The Id of the transaction
+ */
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ /**
+ * Sets the Id of the transaction.
+ *
+ * @param transactionId The Id of the transaction
+ */
+ public void setTransactionId(String transactionId) {
+ if (!isValidTransactionId(transactionId)) {
+ throw new PropertyConstraintException(transactionId, "transactionId is invalid");
+ }
+ this.transactionId = transactionId;
+ }
+
+ /**
+ * Returns whether the given transactionId is valid
+ *
+ * @param transactionId the transactionId to check the validity of
+ * @return {@code true} if transactionId is valid, {@code false} if not
+ */
+ private boolean isValidTransactionId(String transactionId) {
+ return transactionId != null && transactionId.length() <= 36;
+ }
+
+ /**
+ * Gets current charging state, is required when state has changed.
+ *
+ * @return Current charging state, is required when state has changed
+ */
+ @Nullable
+ public ChargingStateEnum getChargingState() {
+ return chargingState;
+ }
+
+ /**
+ * Sets current charging state, is required when state has changed.
+ *
+ * @param chargingState Current charging state, is required when state has changed
+ */
+ public void setChargingState(@Nullable ChargingStateEnum chargingState) {
+ this.chargingState = chargingState;
+ }
+
+ /**
+ * Adds current charging state, is required when state has changed.
+ *
+ * @param chargingState Current charging state, is required when state has changed
+ * @return this
+ */
+ public Transaction withChargingState(@Nullable ChargingStateEnum chargingState) {
+ setChargingState(chargingState);
+ return this;
+ }
+
+ /**
+ * Gets the total time that energy flowed from EVSE to EV during the transaction (in seconds).
+ * Note that timeSpentCharging is smaller or equal to the duration of the transaction.
+ *
+ * @return The total time that energy flowed from EVSE to EV during the transaction (in seconds)
+ */
+ @Nullable
+ public Integer getTimeSpentCharging() {
+ return timeSpentCharging;
+ }
+
+ /**
+ * Sets the total time that energy flowed from EVSE to EV during the transaction (in seconds).
+ * Note that timeSpentCharging is smaller or equal to the duration of the transaction.
+ *
+ * @param timeSpentCharging The total time that energy flowed from EVSE to EV during the
+ * transaction (in seconds)
+ */
+ public void setTimeSpentCharging(@Nullable Integer timeSpentCharging) {
+ this.timeSpentCharging = timeSpentCharging;
+ }
+
+ /**
+ * Adds the total time that energy flowed from EVSE to EV during the transaction (in seconds).
+ * Note that timeSpentCharging is smaller or equal to the duration of the transaction.
+ *
+ * @param timeSpentCharging The total time that energy flowed from EVSE to EV during the
+ * transaction (in seconds)
+ * @return this
+ */
+ public Transaction withTimeSpentCharging(@Nullable Integer timeSpentCharging) {
+ setTimeSpentCharging(timeSpentCharging);
+ return this;
+ }
+
+ /**
+ * Gets the reason why the transaction was stopped. MAY only be omitted when Reason is "Local".
+ *
+ * @return The reason why the transaction was stopped
+ */
+ @Nullable
+ public ReasonEnum getStoppedReason() {
+ return stoppedReason;
+ }
+
+ /**
+ * Sets the reason why the transaction was stopped. MAY only be omitted when Reason is "Local".
+ *
+ * @param stoppedReason The reason why the transaction was stopped
+ */
+ public void setStoppedReason(@Nullable ReasonEnum stoppedReason) {
+ this.stoppedReason = stoppedReason;
+ }
+
+ /**
+ * Adds the reason why the transaction was stopped. MAY only be omitted when Reason is "Local".
+ *
+ * @param stoppedReason The reason why the transaction was stopped
+ * @return this
+ */
+ public Transaction withStoppedReason(@Nullable ReasonEnum stoppedReason) {
+ setStoppedReason(stoppedReason);
+ return this;
+ }
+
+ /**
+ * Gets the ID given to remote start request (RequestStartTransactionRequest. This enables to CSMS
+ * to match the started transaction to the given start request.
+ *
+ * @return The ID given to remote start request (RequestStartTransactionRequest
+ */
+ @Nullable
+ public Integer getRemoteStartId() {
+ return remoteStartId;
+ }
+
+ /**
+ * Sets the ID given to remote start request (RequestStartTransactionRequest. This enables to CSMS
+ * to match the started transaction to the given start request.
+ *
+ * @param remoteStartId The ID given to remote start request (RequestStartTransactionRequest
+ */
+ public void setRemoteStartId(@Nullable Integer remoteStartId) {
+ this.remoteStartId = remoteStartId;
+ }
+
+ /**
+ * Adds the ID given to remote start request (RequestStartTransactionRequest. This enables to CSMS
+ * to match the started transaction to the given start request.
+ *
+ * @param remoteStartId The ID given to remote start request (RequestStartTransactionRequest
+ * @return this
+ */
+ public Transaction withRemoteStartId(@Nullable Integer remoteStartId) {
+ setRemoteStartId(remoteStartId);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidTransactionId(transactionId);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Transaction that = (Transaction) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(transactionId, that.transactionId)
+ && Objects.equals(chargingState, that.chargingState)
+ && Objects.equals(timeSpentCharging, that.timeSpentCharging)
+ && Objects.equals(stoppedReason, that.stoppedReason)
+ && Objects.equals(remoteStartId, that.remoteStartId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, transactionId, chargingState, timeSpentCharging, stoppedReason, remoteStartId);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("transactionId", transactionId)
+ .add("chargingState", chargingState)
+ .add("timeSpentCharging", timeSpentCharging)
+ .add("stoppedReason", stoppedReason)
+ .add("remoteStartId", remoteStartId)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/TransactionEventEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/TransactionEventEnum.java
new file mode 100644
index 000000000..73806d7b6
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/TransactionEventEnum.java
@@ -0,0 +1,35 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * The type of this event. The first TransactionEvent of a transaction SHALL contain: "Started" The
+ * last TransactionEvent of a transaction SHALL contain: "Ended" All others SHALL contain: "Updated"
+ */
+public enum TransactionEventEnum {
+ Ended,
+ Started,
+ Updated
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/TriggerMessageStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/TriggerMessageStatusEnum.java
new file mode 100644
index 000000000..6425564a2
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/TriggerMessageStatusEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether the Charging Station will send the requested notification or not. */
+public enum TriggerMessageStatusEnum {
+ Accepted,
+ Rejected,
+ NotImplemented
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/TriggerReasonEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/TriggerReasonEnum.java
new file mode 100644
index 000000000..b5cd51066
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/TriggerReasonEnum.java
@@ -0,0 +1,50 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Reason the Charging Station sends this message to the CSMS */
+public enum TriggerReasonEnum {
+ Authorized,
+ CablePluggedIn,
+ ChargingRateChanged,
+ ChargingStateChanged,
+ Deauthorized,
+ EnergyLimitReached,
+ EVCommunicationLost,
+ EVConnectTimeout,
+ MeterValueClock,
+ MeterValuePeriodic,
+ TimeLimitReached,
+ Trigger,
+ UnlockCommand,
+ StopAuthorized,
+ EVDeparted,
+ EVDetected,
+ RemoteStop,
+ RemoteStart,
+ AbnormalCondition,
+ SignedDataReceived,
+ ResetCommand
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UnitOfMeasure.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UnitOfMeasure.java
new file mode 100644
index 000000000..6abdb1ebb
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UnitOfMeasure.java
@@ -0,0 +1,208 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** A UnitOfMeasure with a multiplier */
+public final class UnitOfMeasure {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Unit of the value. Default = "Wh" if the (default) measurand is an "Energy" type. This field
+ * SHALL use a value from the list Standardized Units of Measurements in Part 2 Appendices. If an
+ * applicable unit is available in that list, otherwise a "custom" unit might be used.
+ */
+ @Nullable private String unit;
+
+ /**
+ * Multiplier, this value represents the exponent to base 10. I.e. multiplier 3 means 10 raised to
+ * the 3rd power. Default is 0.
+ */
+ @Nullable private Integer multiplier;
+
+ /** Constructor for the UnitOfMeasure class */
+ public UnitOfMeasure() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public UnitOfMeasure withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets unit of the value. Default = "Wh" if the (default) measurand is an "Energy" type. This
+ * field SHALL use a value from the list Standardized Units of Measurements in Part 2 Appendices.
+ * If an applicable unit is available in that list, otherwise a "custom" unit might be used.
+ *
+ * @return Unit of the value
+ */
+ public String getUnit() {
+ return unit != null ? unit : "Wh";
+ }
+
+ /**
+ * Sets unit of the value. Default = "Wh" if the (default) measurand is an "Energy" type. This
+ * field SHALL use a value from the list Standardized Units of Measurements in Part 2 Appendices.
+ * If an applicable unit is available in that list, otherwise a "custom" unit might be used.
+ *
+ * @param unit Unit of the value
+ */
+ public void setUnit(@Nullable String unit) {
+ if (!isValidUnit(unit)) {
+ throw new PropertyConstraintException(unit, "unit is invalid");
+ }
+ this.unit = unit;
+ }
+
+ /**
+ * Returns whether the given unit is valid
+ *
+ * @param unit the unit to check the validity of
+ * @return {@code true} if unit is valid, {@code false} if not
+ */
+ private boolean isValidUnit(@Nullable String unit) {
+ return unit == null || unit.length() <= 20;
+ }
+
+ /**
+ * Adds unit of the value. Default = "Wh" if the (default) measurand is an "Energy" type. This
+ * field SHALL use a value from the list Standardized Units of Measurements in Part 2 Appendices.
+ * If an applicable unit is available in that list, otherwise a "custom" unit might be used.
+ *
+ * @param unit Unit of the value
+ * @return this
+ */
+ public UnitOfMeasure withUnit(@Nullable String unit) {
+ setUnit(unit);
+ return this;
+ }
+
+ /**
+ * Gets multiplier, this value represents the exponent to base 10. I.e. multiplier 3 means 10
+ * raised to the 3rd power. Default is 0.
+ *
+ * @return Multiplier, this value represents the exponent to base 10
+ */
+ public Integer getMultiplier() {
+ return multiplier != null ? multiplier : 0;
+ }
+
+ /**
+ * Sets multiplier, this value represents the exponent to base 10. I.e. multiplier 3 means 10
+ * raised to the 3rd power. Default is 0.
+ *
+ * @param multiplier Multiplier, this value represents the exponent to base 10
+ */
+ public void setMultiplier(@Nullable Integer multiplier) {
+ this.multiplier = multiplier;
+ }
+
+ /**
+ * Adds multiplier, this value represents the exponent to base 10. I.e. multiplier 3 means 10
+ * raised to the 3rd power. Default is 0.
+ *
+ * @param multiplier Multiplier, this value represents the exponent to base 10
+ * @return this
+ */
+ public UnitOfMeasure withMultiplier(@Nullable Integer multiplier) {
+ setMultiplier(multiplier);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidUnit(unit);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ UnitOfMeasure that = (UnitOfMeasure) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(unit, that.unit)
+ && Objects.equals(multiplier, that.multiplier);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, unit, multiplier);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("unit", unit)
+ .add("multiplier", multiplier)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UnlockStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UnlockStatusEnum.java
new file mode 100644
index 000000000..0be9356c9
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UnlockStatusEnum.java
@@ -0,0 +1,33 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether the Charging Station has unlocked the connector. */
+public enum UnlockStatusEnum {
+ Unlocked,
+ UnlockFailed,
+ OngoingAuthorizedTransaction,
+ UnknownConnector
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UnpublishFirmwareStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UnpublishFirmwareStatusEnum.java
new file mode 100644
index 000000000..a77c3a3dc
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UnpublishFirmwareStatusEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether the Local Controller succeeded in unpublishing the firmware. */
+public enum UnpublishFirmwareStatusEnum {
+ DownloadOngoing,
+ NoFirmware,
+ Unpublished
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UpdateEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UpdateEnum.java
new file mode 100644
index 000000000..c9a58e6bf
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UpdateEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The type of update (full or differential) of this request. */
+public enum UpdateEnum {
+ Differential,
+ Full
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UpdateFirmwareStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UpdateFirmwareStatusEnum.java
new file mode 100644
index 000000000..84b53de1f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UpdateFirmwareStatusEnum.java
@@ -0,0 +1,34 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** This field indicates whether the Charging Station was able to accept the request. */
+public enum UpdateFirmwareStatusEnum {
+ Accepted,
+ Rejected,
+ AcceptedCanceled,
+ InvalidCertificate,
+ RevokedCertificate
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UploadLogStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UploadLogStatusEnum.java
new file mode 100644
index 000000000..cf0f5848a
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/UploadLogStatusEnum.java
@@ -0,0 +1,37 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The status of the log upload. */
+public enum UploadLogStatusEnum {
+ BadMessage,
+ Idle,
+ NotSupportedOperation,
+ PermissionDenied,
+ Uploaded,
+ UploadFailure,
+ Uploading,
+ AcceptedCanceled
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VPN.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VPN.java
new file mode 100644
index 000000000..baf2d7f6d
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VPN.java
@@ -0,0 +1,387 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * VPN
+ *
+ * VPN Configuration settings
+ */
+public final class VPN {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * VPN. Server. URI
+ *
+ * VPN Server Address
+ */
+ private String server;
+
+ /**
+ * VPN. User. User Name
+ *
+ * VPN User
+ */
+ private String user;
+
+ /**
+ * VPN. Group. Group Name
+ *
+ * VPN group.
+ */
+ @Nullable private String group;
+
+ /**
+ * VPN. Password. Password
+ *
+ * VPN Password.
+ */
+ private String password;
+
+ /**
+ * VPN. Key. VPN Key
+ *
+ * VPN shared secret.
+ */
+ private String key;
+
+ /**
+ * VPN. Type. VPN Code
+ *
+ * Type of VPN
+ */
+ private VPNEnum type;
+
+ /**
+ * Constructor for the VPN class
+ *
+ * @param server VPN Server Address
+ * @param user VPN User
+ * @param password VPN Password.
+ * @param key VPN shared secret.
+ * @param type Type of VPN
+ */
+ public VPN(String server, String user, String password, String key, VPNEnum type) {
+ setServer(server);
+ setUser(user);
+ setPassword(password);
+ setKey(key);
+ setType(type);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public VPN withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets VPN Server Address
+ *
+ * @return VPN Server Address
+ */
+ public String getServer() {
+ return server;
+ }
+
+ /**
+ * Sets VPN Server Address
+ *
+ * @param server VPN Server Address
+ */
+ public void setServer(String server) {
+ if (!isValidServer(server)) {
+ throw new PropertyConstraintException(server, "server is invalid");
+ }
+ this.server = server;
+ }
+
+ /**
+ * Returns whether the given server is valid
+ *
+ * @param server the server to check the validity of
+ * @return {@code true} if server is valid, {@code false} if not
+ */
+ private boolean isValidServer(String server) {
+ return server != null && server.length() <= 512;
+ }
+
+ /**
+ * Gets VPN User
+ *
+ * @return VPN User
+ */
+ public String getUser() {
+ return user;
+ }
+
+ /**
+ * Sets VPN User
+ *
+ * @param user VPN User
+ */
+ public void setUser(String user) {
+ if (!isValidUser(user)) {
+ throw new PropertyConstraintException(user, "user is invalid");
+ }
+ this.user = user;
+ }
+
+ /**
+ * Returns whether the given user is valid
+ *
+ * @param user the user to check the validity of
+ * @return {@code true} if user is valid, {@code false} if not
+ */
+ private boolean isValidUser(String user) {
+ return user != null && user.length() <= 20;
+ }
+
+ /**
+ * Gets VPN group.
+ *
+ * @return VPN group
+ */
+ @Nullable
+ public String getGroup() {
+ return group;
+ }
+
+ /**
+ * Sets VPN group.
+ *
+ * @param group VPN group
+ */
+ public void setGroup(@Nullable String group) {
+ if (!isValidGroup(group)) {
+ throw new PropertyConstraintException(group, "group is invalid");
+ }
+ this.group = group;
+ }
+
+ /**
+ * Returns whether the given group is valid
+ *
+ * @param group the group to check the validity of
+ * @return {@code true} if group is valid, {@code false} if not
+ */
+ private boolean isValidGroup(@Nullable String group) {
+ return group == null || group.length() <= 20;
+ }
+
+ /**
+ * Adds VPN group.
+ *
+ * @param group VPN group
+ * @return this
+ */
+ public VPN withGroup(@Nullable String group) {
+ setGroup(group);
+ return this;
+ }
+
+ /**
+ * Gets VPN Password.
+ *
+ * @return VPN Password
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * Sets VPN Password.
+ *
+ * @param password VPN Password
+ */
+ public void setPassword(String password) {
+ if (!isValidPassword(password)) {
+ throw new PropertyConstraintException(password, "password is invalid");
+ }
+ this.password = password;
+ }
+
+ /**
+ * Returns whether the given password is valid
+ *
+ * @param password the password to check the validity of
+ * @return {@code true} if password is valid, {@code false} if not
+ */
+ private boolean isValidPassword(String password) {
+ return password != null && password.length() <= 20;
+ }
+
+ /**
+ * Gets VPN shared secret.
+ *
+ * @return VPN shared secret
+ */
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * Sets VPN shared secret.
+ *
+ * @param key VPN shared secret
+ */
+ public void setKey(String key) {
+ if (!isValidKey(key)) {
+ throw new PropertyConstraintException(key, "key is invalid");
+ }
+ this.key = key;
+ }
+
+ /**
+ * Returns whether the given key is valid
+ *
+ * @param key the key to check the validity of
+ * @return {@code true} if key is valid, {@code false} if not
+ */
+ private boolean isValidKey(String key) {
+ return key != null && key.length() <= 255;
+ }
+
+ /**
+ * Gets type of VPN
+ *
+ * @return Type of VPN
+ */
+ public VPNEnum getType() {
+ return type;
+ }
+
+ /**
+ * Sets type of VPN
+ *
+ * @param type Type of VPN
+ */
+ public void setType(VPNEnum type) {
+ if (!isValidType(type)) {
+ throw new PropertyConstraintException(type, "type is invalid");
+ }
+ this.type = type;
+ }
+
+ /**
+ * Returns whether the given type is valid
+ *
+ * @param type the type to check the validity of
+ * @return {@code true} if type is valid, {@code false} if not
+ */
+ private boolean isValidType(VPNEnum type) {
+ return type != null;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidServer(server)
+ && isValidUser(user)
+ && isValidGroup(group)
+ && isValidPassword(password)
+ && isValidKey(key)
+ && isValidType(type);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ VPN that = (VPN) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(server, that.server)
+ && Objects.equals(user, that.user)
+ && Objects.equals(group, that.group)
+ && Objects.equals(password, that.password)
+ && Objects.equals(key, that.key)
+ && Objects.equals(type, that.type);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, server, user, group, password, key, type);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("server", server)
+ .add("user", user)
+ .add("group", group)
+ .add("password", password)
+ .add("key", key)
+ .add("type", type)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VPNEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VPNEnum.java
new file mode 100644
index 000000000..265647f58
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VPNEnum.java
@@ -0,0 +1,37 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * VPN. Type. VPN Code
+ *
+ * Type of VPN
+ */
+public enum VPNEnum {
+ IKEv2,
+ IPSec,
+ L2TP,
+ PPTP
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Variable.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Variable.java
new file mode 100644
index 000000000..53ffde84f
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/Variable.java
@@ -0,0 +1,213 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Reference key to a component-variable. */
+public final class Variable {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Name of the variable. Name should be taken from the list of standardized variable names
+ * whenever possible. Case Insensitive. strongly advised to use Camel Case.
+ */
+ private String name;
+
+ /**
+ * Name of instance in case the variable exists as multiple instances. Case Insensitive. strongly
+ * advised to use Camel Case.
+ */
+ @Nullable private String instance;
+
+ /**
+ * Constructor for the Variable class
+ *
+ * @param name Name of the variable. Name should be taken from the list of standardized variable
+ * names whenever possible. Case Insensitive. strongly advised to use Camel Case.
+ */
+ public Variable(String name) {
+ setName(name);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public Variable withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets name of the variable. Name should be taken from the list of standardized variable names
+ * whenever possible. Case Insensitive. strongly advised to use Camel Case.
+ *
+ * @return Name of the variable
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets name of the variable. Name should be taken from the list of standardized variable names
+ * whenever possible. Case Insensitive. strongly advised to use Camel Case.
+ *
+ * @param name Name of the variable
+ */
+ public void setName(String name) {
+ if (!isValidName(name)) {
+ throw new PropertyConstraintException(name, "name is invalid");
+ }
+ this.name = name;
+ }
+
+ /**
+ * Returns whether the given name is valid
+ *
+ * @param name the name to check the validity of
+ * @return {@code true} if name is valid, {@code false} if not
+ */
+ private boolean isValidName(String name) {
+ return name != null && name.length() <= 50;
+ }
+
+ /**
+ * Gets name of instance in case the variable exists as multiple instances. Case Insensitive.
+ * strongly advised to use Camel Case.
+ *
+ * @return Name of instance in case the variable exists as multiple instances
+ */
+ @Nullable
+ public String getInstance() {
+ return instance;
+ }
+
+ /**
+ * Sets name of instance in case the variable exists as multiple instances. Case Insensitive.
+ * strongly advised to use Camel Case.
+ *
+ * @param instance Name of instance in case the variable exists as multiple instances
+ */
+ public void setInstance(@Nullable String instance) {
+ if (!isValidInstance(instance)) {
+ throw new PropertyConstraintException(instance, "instance is invalid");
+ }
+ this.instance = instance;
+ }
+
+ /**
+ * Returns whether the given instance is valid
+ *
+ * @param instance the instance to check the validity of
+ * @return {@code true} if instance is valid, {@code false} if not
+ */
+ private boolean isValidInstance(@Nullable String instance) {
+ return instance == null || instance.length() <= 50;
+ }
+
+ /**
+ * Adds name of instance in case the variable exists as multiple instances. Case Insensitive.
+ * strongly advised to use Camel Case.
+ *
+ * @param instance Name of instance in case the variable exists as multiple instances
+ * @return this
+ */
+ public Variable withInstance(@Nullable String instance) {
+ setInstance(instance);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidName(name) && isValidInstance(instance);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Variable that = (Variable) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(name, that.name)
+ && Objects.equals(instance, that.instance);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, name, instance);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("name", name)
+ .add("instance", instance)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VariableAttribute.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VariableAttribute.java
new file mode 100644
index 000000000..2f1241ff5
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VariableAttribute.java
@@ -0,0 +1,313 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Attribute data of a variable. */
+public final class VariableAttribute {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Attribute: Actual, MinSet, MaxSet, etc. Defaults to Actual if absent. */
+ @Nullable private AttributeEnum type;
+
+ /**
+ * Value of the attribute. May only be omitted when mutability is set to 'WriteOnly'.
+ *
+ * The Configuration Variable ReportingValueSize can be used to limit
+ * GetVariableResult.attributeValue, VariableAttribute.value and EventData.actualValue. The max
+ * size of these values will always remain equal.
+ */
+ @Nullable private String value;
+
+ /** The mutability of this attribute. Default is ReadWrite when omitted. */
+ @Nullable private MutabilityEnum mutability;
+
+ /**
+ * Whether value will be persistent across system reboots or power down. Default when omitted is
+ * false.
+ */
+ @Nullable private Boolean persistent;
+
+ /**
+ * Whether value that will never be changed by the Charging Station at runtime. Default when
+ * omitted is false.
+ */
+ @Nullable private Boolean constant;
+
+ /** Constructor for the VariableAttribute class */
+ public VariableAttribute() {}
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public VariableAttribute withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets attribute: Actual, MinSet, MaxSet, etc. Defaults to Actual if absent.
+ *
+ * @return Attribute: Actual, MinSet, MaxSet, etc
+ */
+ public AttributeEnum getType() {
+ return type != null ? type : AttributeEnum.Actual;
+ }
+
+ /**
+ * Sets attribute: Actual, MinSet, MaxSet, etc. Defaults to Actual if absent.
+ *
+ * @param type Attribute: Actual, MinSet, MaxSet, etc
+ */
+ public void setType(@Nullable AttributeEnum type) {
+ this.type = type;
+ }
+
+ /**
+ * Adds attribute: Actual, MinSet, MaxSet, etc. Defaults to Actual if absent.
+ *
+ * @param type Attribute: Actual, MinSet, MaxSet, etc
+ * @return this
+ */
+ public VariableAttribute withType(@Nullable AttributeEnum type) {
+ setType(type);
+ return this;
+ }
+
+ /**
+ * Gets value of the attribute. May only be omitted when mutability is set to 'WriteOnly'.
+ *
+ * @return Value of the attribute
+ */
+ @Nullable
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets value of the attribute. May only be omitted when mutability is set to 'WriteOnly'.
+ *
+ * @param value Value of the attribute
+ */
+ public void setValue(@Nullable String value) {
+ if (!isValidValue(value)) {
+ throw new PropertyConstraintException(value, "value is invalid");
+ }
+ this.value = value;
+ }
+
+ /**
+ * Returns whether the given value is valid
+ *
+ * @param value the value to check the validity of
+ * @return {@code true} if value is valid, {@code false} if not
+ */
+ private boolean isValidValue(@Nullable String value) {
+ return value == null || value.length() <= 2500;
+ }
+
+ /**
+ * Adds value of the attribute. May only be omitted when mutability is set to 'WriteOnly'.
+ *
+ * @param value Value of the attribute
+ * @return this
+ */
+ public VariableAttribute withValue(@Nullable String value) {
+ setValue(value);
+ return this;
+ }
+
+ /**
+ * Gets the mutability of this attribute. Default is ReadWrite when omitted.
+ *
+ * @return The mutability of this attribute
+ */
+ public MutabilityEnum getMutability() {
+ return mutability != null ? mutability : MutabilityEnum.ReadWrite;
+ }
+
+ /**
+ * Sets the mutability of this attribute. Default is ReadWrite when omitted.
+ *
+ * @param mutability The mutability of this attribute
+ */
+ public void setMutability(@Nullable MutabilityEnum mutability) {
+ this.mutability = mutability;
+ }
+
+ /**
+ * Adds the mutability of this attribute. Default is ReadWrite when omitted.
+ *
+ * @param mutability The mutability of this attribute
+ * @return this
+ */
+ public VariableAttribute withMutability(@Nullable MutabilityEnum mutability) {
+ setMutability(mutability);
+ return this;
+ }
+
+ /**
+ * Gets whether value will be persistent across system reboots or power down. Default when omitted
+ * is false.
+ *
+ * @return Whether value will be persistent across system reboots or power down
+ */
+ public Boolean getPersistent() {
+ return persistent != null ? persistent : false;
+ }
+
+ /**
+ * Sets whether value will be persistent across system reboots or power down. Default when omitted
+ * is false.
+ *
+ * @param persistent Whether value will be persistent across system reboots or power down
+ */
+ public void setPersistent(@Nullable Boolean persistent) {
+ this.persistent = persistent;
+ }
+
+ /**
+ * Adds whether value will be persistent across system reboots or power down. Default when omitted
+ * is false.
+ *
+ * @param persistent Whether value will be persistent across system reboots or power down
+ * @return this
+ */
+ public VariableAttribute withPersistent(@Nullable Boolean persistent) {
+ setPersistent(persistent);
+ return this;
+ }
+
+ /**
+ * Gets whether value that will never be changed by the Charging Station at runtime. Default when
+ * omitted is false.
+ *
+ * @return Whether value that will never be changed by the Charging Station at runtime
+ */
+ public Boolean getConstant() {
+ return constant != null ? constant : false;
+ }
+
+ /**
+ * Sets whether value that will never be changed by the Charging Station at runtime. Default when
+ * omitted is false.
+ *
+ * @param constant Whether value that will never be changed by the Charging Station at runtime
+ */
+ public void setConstant(@Nullable Boolean constant) {
+ this.constant = constant;
+ }
+
+ /**
+ * Adds whether value that will never be changed by the Charging Station at runtime. Default when
+ * omitted is false.
+ *
+ * @param constant Whether value that will never be changed by the Charging Station at runtime
+ * @return this
+ */
+ public VariableAttribute withConstant(@Nullable Boolean constant) {
+ setConstant(constant);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidValue(value);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ VariableAttribute that = (VariableAttribute) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(type, that.type)
+ && Objects.equals(value, that.value)
+ && Objects.equals(mutability, that.mutability)
+ && Objects.equals(persistent, that.persistent)
+ && Objects.equals(constant, that.constant);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, type, value, mutability, persistent, constant);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("type", type)
+ .add("value", value)
+ .add("mutability", mutability)
+ .add("persistent", persistent)
+ .add("constant", constant)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VariableCharacteristics.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VariableCharacteristics.java
new file mode 100644
index 000000000..b603d40b5
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VariableCharacteristics.java
@@ -0,0 +1,389 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Fixed read-only parameters of a variable. */
+public final class VariableCharacteristics {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Unit of the variable. When the transmitted value has a unit, this field SHALL be included. */
+ @Nullable private String unit;
+
+ /** Data type of this variable. */
+ private DataEnum dataType;
+
+ /** Minimum possible value of this variable. */
+ @Nullable private Double minLimit;
+
+ /**
+ * Maximum possible value of this variable. When the datatype of this Variable is String,
+ * OptionList, SequenceList or MemberList, this field defines the maximum length of the (CSV)
+ * string.
+ */
+ @Nullable private Double maxLimit;
+
+ /**
+ * Allowed values when variable is Option/Member/SequenceList.
+ *
+ * * OptionList: The (Actual) Variable value must be a single value from the reported (CSV)
+ * enumeration list.
+ *
+ * * MemberList: The (Actual) Variable value may be an (unordered) (sub-)set of the reported
+ * (CSV) valid values list.
+ *
+ * * SequenceList: The (Actual) Variable value may be an ordered (priority, etc) (sub-)set of
+ * the reported (CSV) valid values.
+ *
+ * This is a comma separated list.
+ *
+ * The Configuration Variable ConfigurationValueSize can be used to limit
+ * SetVariableData.attributeValue and VariableCharacteristics.valueList. The max size of these
+ * values will always remain equal.
+ */
+ @Nullable private String valuesList;
+
+ /** Flag indicating if this variable supports monitoring. */
+ private Boolean supportsMonitoring;
+
+ /**
+ * Constructor for the VariableCharacteristics class
+ *
+ * @param dataType Data type of this variable.
+ * @param supportsMonitoring Flag indicating if this variable supports monitoring.
+ */
+ public VariableCharacteristics(DataEnum dataType, Boolean supportsMonitoring) {
+ setDataType(dataType);
+ setSupportsMonitoring(supportsMonitoring);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public VariableCharacteristics withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets unit of the variable. When the transmitted value has a unit, this field SHALL be included.
+ *
+ * @return Unit of the variable
+ */
+ @Nullable
+ public String getUnit() {
+ return unit;
+ }
+
+ /**
+ * Sets unit of the variable. When the transmitted value has a unit, this field SHALL be included.
+ *
+ * @param unit Unit of the variable
+ */
+ public void setUnit(@Nullable String unit) {
+ if (!isValidUnit(unit)) {
+ throw new PropertyConstraintException(unit, "unit is invalid");
+ }
+ this.unit = unit;
+ }
+
+ /**
+ * Returns whether the given unit is valid
+ *
+ * @param unit the unit to check the validity of
+ * @return {@code true} if unit is valid, {@code false} if not
+ */
+ private boolean isValidUnit(@Nullable String unit) {
+ return unit == null || unit.length() <= 16;
+ }
+
+ /**
+ * Adds unit of the variable. When the transmitted value has a unit, this field SHALL be included.
+ *
+ * @param unit Unit of the variable
+ * @return this
+ */
+ public VariableCharacteristics withUnit(@Nullable String unit) {
+ setUnit(unit);
+ return this;
+ }
+
+ /**
+ * Gets data type of this variable.
+ *
+ * @return Data type of this variable
+ */
+ public DataEnum getDataType() {
+ return dataType;
+ }
+
+ /**
+ * Sets data type of this variable.
+ *
+ * @param dataType Data type of this variable
+ */
+ public void setDataType(DataEnum dataType) {
+ if (!isValidDataType(dataType)) {
+ throw new PropertyConstraintException(dataType, "dataType is invalid");
+ }
+ this.dataType = dataType;
+ }
+
+ /**
+ * Returns whether the given dataType is valid
+ *
+ * @param dataType the dataType to check the validity of
+ * @return {@code true} if dataType is valid, {@code false} if not
+ */
+ private boolean isValidDataType(DataEnum dataType) {
+ return dataType != null;
+ }
+
+ /**
+ * Gets minimum possible value of this variable.
+ *
+ * @return Minimum possible value of this variable
+ */
+ @Nullable
+ public Double getMinLimit() {
+ return minLimit;
+ }
+
+ /**
+ * Sets minimum possible value of this variable.
+ *
+ * @param minLimit Minimum possible value of this variable
+ */
+ public void setMinLimit(@Nullable Double minLimit) {
+ this.minLimit = minLimit;
+ }
+
+ /**
+ * Adds minimum possible value of this variable.
+ *
+ * @param minLimit Minimum possible value of this variable
+ * @return this
+ */
+ public VariableCharacteristics withMinLimit(@Nullable Double minLimit) {
+ setMinLimit(minLimit);
+ return this;
+ }
+
+ /**
+ * Gets maximum possible value of this variable. When the datatype of this Variable is String,
+ * OptionList, SequenceList or MemberList, this field defines the maximum length of the (CSV)
+ * string.
+ *
+ * @return Maximum possible value of this variable
+ */
+ @Nullable
+ public Double getMaxLimit() {
+ return maxLimit;
+ }
+
+ /**
+ * Sets maximum possible value of this variable. When the datatype of this Variable is String,
+ * OptionList, SequenceList or MemberList, this field defines the maximum length of the (CSV)
+ * string.
+ *
+ * @param maxLimit Maximum possible value of this variable
+ */
+ public void setMaxLimit(@Nullable Double maxLimit) {
+ this.maxLimit = maxLimit;
+ }
+
+ /**
+ * Adds maximum possible value of this variable. When the datatype of this Variable is String,
+ * OptionList, SequenceList or MemberList, this field defines the maximum length of the (CSV)
+ * string.
+ *
+ * @param maxLimit Maximum possible value of this variable
+ * @return this
+ */
+ public VariableCharacteristics withMaxLimit(@Nullable Double maxLimit) {
+ setMaxLimit(maxLimit);
+ return this;
+ }
+
+ /**
+ * Gets allowed values when variable is Option/Member/SequenceList.
+ *
+ * @return Allowed values when variable is Option/Member/SequenceList
+ */
+ @Nullable
+ public String getValuesList() {
+ return valuesList;
+ }
+
+ /**
+ * Sets allowed values when variable is Option/Member/SequenceList.
+ *
+ * @param valuesList Allowed values when variable is Option/Member/SequenceList
+ */
+ public void setValuesList(@Nullable String valuesList) {
+ if (!isValidValuesList(valuesList)) {
+ throw new PropertyConstraintException(valuesList, "valuesList is invalid");
+ }
+ this.valuesList = valuesList;
+ }
+
+ /**
+ * Returns whether the given valuesList is valid
+ *
+ * @param valuesList the valuesList to check the validity of
+ * @return {@code true} if valuesList is valid, {@code false} if not
+ */
+ private boolean isValidValuesList(@Nullable String valuesList) {
+ return valuesList == null || valuesList.length() <= 1000;
+ }
+
+ /**
+ * Adds allowed values when variable is Option/Member/SequenceList.
+ *
+ * @param valuesList Allowed values when variable is Option/Member/SequenceList
+ * @return this
+ */
+ public VariableCharacteristics withValuesList(@Nullable String valuesList) {
+ setValuesList(valuesList);
+ return this;
+ }
+
+ /**
+ * Gets flag indicating if this variable supports monitoring.
+ *
+ * @return Flag indicating if this variable supports monitoring
+ */
+ public Boolean getSupportsMonitoring() {
+ return supportsMonitoring;
+ }
+
+ /**
+ * Sets flag indicating if this variable supports monitoring.
+ *
+ * @param supportsMonitoring Flag indicating if this variable supports monitoring
+ */
+ public void setSupportsMonitoring(Boolean supportsMonitoring) {
+ if (!isValidSupportsMonitoring(supportsMonitoring)) {
+ throw new PropertyConstraintException(supportsMonitoring, "supportsMonitoring is invalid");
+ }
+ this.supportsMonitoring = supportsMonitoring;
+ }
+
+ /**
+ * Returns whether the given supportsMonitoring is valid
+ *
+ * @param supportsMonitoring the supportsMonitoring to check the validity of
+ * @return {@code true} if supportsMonitoring is valid, {@code false} if not
+ */
+ private boolean isValidSupportsMonitoring(Boolean supportsMonitoring) {
+ return supportsMonitoring != null;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidUnit(unit)
+ && isValidDataType(dataType)
+ && isValidValuesList(valuesList)
+ && isValidSupportsMonitoring(supportsMonitoring);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ VariableCharacteristics that = (VariableCharacteristics) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(unit, that.unit)
+ && Objects.equals(dataType, that.dataType)
+ && Objects.equals(minLimit, that.minLimit)
+ && Objects.equals(maxLimit, that.maxLimit)
+ && Objects.equals(valuesList, that.valuesList)
+ && Objects.equals(supportsMonitoring, that.supportsMonitoring);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData, unit, dataType, minLimit, maxLimit, valuesList, supportsMonitoring);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("unit", unit)
+ .add("dataType", dataType)
+ .add("minLimit", minLimit)
+ .add("maxLimit", maxLimit)
+ .add("valuesList", valuesList)
+ .add("supportsMonitoring", supportsMonitoring)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VariableMonitoring.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VariableMonitoring.java
new file mode 100644
index 000000000..c8c73da3a
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/VariableMonitoring.java
@@ -0,0 +1,356 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** A monitoring setting for a variable. */
+public final class VariableMonitoring {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** The identifier of the monitor. */
+ private Integer id;
+
+ /**
+ * Monitor only active when a transaction is ongoing on a component relevant to this transaction.
+ */
+ private Boolean transaction;
+
+ /**
+ * Value for threshold or delta monitoring. For Periodic or PeriodicClockAligned this is the
+ * interval in seconds.
+ */
+ private Double value;
+
+ /** The type of this monitor, e.g. a threshold, delta or periodic monitor. */
+ private MonitorEnum type;
+
+ /**
+ * The severity that will be assigned to an event that is triggered by this monitor. The severity
+ * range is 0-9, with 0 as the highest and 9 as the lowest severity level.
+ *
+ *
+ * - if all certificates are valid: return 'Accepted'.
+ * - if one of the certificates was revoked, return 'CertificateRevoked'.
+ *
+ */
+ @Nullable private AuthorizeCertificateStatusEnum certificateStatus;
+
+ /**
+ * Constructor for the AuthorizeResponse class
+ *
+ * @param idTokenInfo Status information about an identifier. It is advised to not stop charging
+ * for a token that expires during charging, as ExpiryDate is only used for caching purposes.
+ * If ExpiryDate is not given, the status has no end date.
+ */
+ public AuthorizeResponse(IdTokenInfo idTokenInfo) {
+ setIdTokenInfo(idTokenInfo);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public AuthorizeResponse withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets status information about an identifier. It is advised to not stop charging for a token
+ * that expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is
+ * not given, the status has no end date.
+ *
+ * @return Status information about an identifier
+ */
+ public IdTokenInfo getIdTokenInfo() {
+ return idTokenInfo;
+ }
+
+ /**
+ * Sets status information about an identifier. It is advised to not stop charging for a token
+ * that expires during charging, as ExpiryDate is only used for caching purposes. If ExpiryDate is
+ * not given, the status has no end date.
+ *
+ * @param idTokenInfo Status information about an identifier
+ */
+ public void setIdTokenInfo(IdTokenInfo idTokenInfo) {
+ if (!isValidIdTokenInfo(idTokenInfo)) {
+ throw new PropertyConstraintException(idTokenInfo, "idTokenInfo is invalid");
+ }
+ this.idTokenInfo = idTokenInfo;
+ }
+
+ /**
+ * Returns whether the given idTokenInfo is valid
+ *
+ * @param idTokenInfo the idTokenInfo to check the validity of
+ * @return {@code true} if idTokenInfo is valid, {@code false} if not
+ */
+ private boolean isValidIdTokenInfo(IdTokenInfo idTokenInfo) {
+ return idTokenInfo != null && idTokenInfo.validate();
+ }
+
+ /**
+ * Gets certificate status information.
+ *
+ * @return Certificate status information
+ */
+ @Nullable
+ public AuthorizeCertificateStatusEnum getCertificateStatus() {
+ return certificateStatus;
+ }
+
+ /**
+ * Sets certificate status information.
+ *
+ * @param certificateStatus Certificate status information
+ */
+ public void setCertificateStatus(@Nullable AuthorizeCertificateStatusEnum certificateStatus) {
+ this.certificateStatus = certificateStatus;
+ }
+
+ /**
+ * Adds certificate status information.
+ *
+ * @param certificateStatus Certificate status information
+ * @return this
+ */
+ public AuthorizeResponse withCertificateStatus(
+ @Nullable AuthorizeCertificateStatusEnum certificateStatus) {
+ setCertificateStatus(certificateStatus);
+ return this;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidIdTokenInfo(idTokenInfo);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ AuthorizeResponse that = (AuthorizeResponse) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(idTokenInfo, that.idTokenInfo)
+ && Objects.equals(certificateStatus, that.certificateStatus);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, idTokenInfo, certificateStatus);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("idTokenInfo", idTokenInfo)
+ .add("certificateStatus", certificateStatus)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/BootNotificationRequest.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/BootNotificationRequest.java
new file mode 100644
index 000000000..6cd820399
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/BootNotificationRequest.java
@@ -0,0 +1,211 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.RequestWithId;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.BootReasonEnum;
+import eu.chargetime.ocpp.v201.model.types.ChargingStation;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * BootNotificationRequest
+ *
+ *
+ * The severity levels have the following meaning: +
+ * *0-Danger* +
+ * Lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
+ * *1-Hardware Failure* +
+ * That the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
+ * *2-System Failure* +
+ * That the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
+ * *3-Critical* +
+ * A critical error. Action is required. +
+ * *4-Error* +
+ * A non-urgent error. Action is required. +
+ * *5-Alert* +
+ * An alert event. Default severity for any type of monitoring event. +
+ * *6-Warning* +
+ * A warning event. Action may be required. +
+ * *7-Notice* +
+ * An unusual event. No immediate action is required. +
+ * *8-Informational* +
+ * A regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
+ * *9-Debug* +
+ * Information useful to developers for debugging, not useful during operations.
+ *
+ */
+ private Integer severity;
+
+ /**
+ * Constructor for the SetMonitoringLevelRequest class
+ *
+ * @param severity The Charging Station SHALL only report events with a severity number lower than
+ * or equal to this severity. The severity range is 0-9, with 0 as the highest and 9 as the
+ * lowest severity level.
+ */
+ public SetMonitoringLevelRequest(Integer severity) {
+ setSeverity(severity);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetMonitoringLevelRequest withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the Charging Station SHALL only report events with a severity number lower than or equal
+ * to this severity. The severity range is 0-9, with 0 as the highest and 9 as the lowest severity
+ * level.
+ *
+ * @return The Charging Station SHALL only report events with a severity number lower than or
+ * equal to this severity
+ */
+ public Integer getSeverity() {
+ return severity;
+ }
+
+ /**
+ * Sets the Charging Station SHALL only report events with a severity number lower than or equal
+ * to this severity. The severity range is 0-9, with 0 as the highest and 9 as the lowest severity
+ * level.
+ *
+ * @param severity The Charging Station SHALL only report events with a severity number lower than
+ * or equal to this severity
+ */
+ public void setSeverity(Integer severity) {
+ if (!isValidSeverity(severity)) {
+ throw new PropertyConstraintException(severity, "severity is invalid");
+ }
+ this.severity = severity;
+ }
+
+ /**
+ * Returns whether the given severity is valid
+ *
+ * @param severity the severity to check the validity of
+ * @return {@code true} if severity is valid, {@code false} if not
+ */
+ private boolean isValidSeverity(Integer severity) {
+ return severity != null;
+ }
+
+ @Override
+ public boolean validate() {
+ return isValidCustomData(customData) && isValidSeverity(severity);
+ }
+
+ @Override
+ public boolean transactionRelated() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetMonitoringLevelRequest that = (SetMonitoringLevelRequest) o;
+ return Objects.equals(customData, that.customData) && Objects.equals(severity, that.severity);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, severity);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("severity", severity)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetMonitoringLevelResponse.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetMonitoringLevelResponse.java
new file mode 100644
index 000000000..e32cf2e02
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/messages/SetMonitoringLevelResponse.java
@@ -0,0 +1,210 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.model.Confirmation;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import eu.chargetime.ocpp.v201.model.types.CustomData;
+import eu.chargetime.ocpp.v201.model.types.GenericStatusEnum;
+import eu.chargetime.ocpp.v201.model.types.StatusInfo;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/**
+ * SetMonitoringLevelResponse
+ *
+ *
+ * - if all certificates are valid: return 'Accepted'.
+ * - if one of the certificates was revoked, return 'CertificateRevoked'.
+ *
+ */
+public enum AuthorizeCertificateStatusEnum {
+ Accepted,
+ SignatureError,
+ CertificateExpired,
+ CertificateRevoked,
+ NoCertificateAvailable,
+ CertChainError,
+ ContractCancelled
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/BootReasonEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/BootReasonEnum.java
new file mode 100644
index 000000000..a6181b73b
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/BootReasonEnum.java
@@ -0,0 +1,38 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The reason for sending this message to the CSMS. */
+public enum BootReasonEnum {
+ ApplicationReset,
+ FirmwareUpdate,
+ LocalReset,
+ PowerUp,
+ RemoteReset,
+ ScheduledReset,
+ Triggered,
+ Unknown,
+ Watchdog
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CancelReservationStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CancelReservationStatusEnum.java
new file mode 100644
index 000000000..e8a995687
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CancelReservationStatusEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** The success or failure of the canceling of a reservation by CSMS. */
+public enum CancelReservationStatusEnum {
+ Accepted,
+ Rejected
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateActionEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateActionEnum.java
new file mode 100644
index 000000000..93fcf327e
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateActionEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether certificate needs to be installed or updated. */
+public enum CertificateActionEnum {
+ Install,
+ Update
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateHashData.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateHashData.java
new file mode 100644
index 000000000..421b48016
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateHashData.java
@@ -0,0 +1,275 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** CertificateHashDataType */
+public final class CertificateHashData {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Used algorithms for the hashes provided. */
+ private HashAlgorithmEnum hashAlgorithm;
+
+ /** Hashed value of the Issuer DN (Distinguished Name). */
+ private String issuerNameHash;
+
+ /** Hashed value of the issuers public key */
+ private String issuerKeyHash;
+
+ /** The serial number of the certificate. */
+ private String serialNumber;
+
+ /**
+ * Constructor for the CertificateHashData class
+ *
+ * @param hashAlgorithm Used algorithms for the hashes provided.
+ * @param issuerNameHash Hashed value of the Issuer DN (Distinguished Name).
+ * @param issuerKeyHash Hashed value of the issuers public key
+ * @param serialNumber The serial number of the certificate.
+ */
+ public CertificateHashData(
+ HashAlgorithmEnum hashAlgorithm,
+ String issuerNameHash,
+ String issuerKeyHash,
+ String serialNumber) {
+ setHashAlgorithm(hashAlgorithm);
+ setIssuerNameHash(issuerNameHash);
+ setIssuerKeyHash(issuerKeyHash);
+ setSerialNumber(serialNumber);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public CertificateHashData withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets used algorithms for the hashes provided.
+ *
+ * @return Used algorithms for the hashes provided
+ */
+ public HashAlgorithmEnum getHashAlgorithm() {
+ return hashAlgorithm;
+ }
+
+ /**
+ * Sets used algorithms for the hashes provided.
+ *
+ * @param hashAlgorithm Used algorithms for the hashes provided
+ */
+ public void setHashAlgorithm(HashAlgorithmEnum hashAlgorithm) {
+ if (!isValidHashAlgorithm(hashAlgorithm)) {
+ throw new PropertyConstraintException(hashAlgorithm, "hashAlgorithm is invalid");
+ }
+ this.hashAlgorithm = hashAlgorithm;
+ }
+
+ /**
+ * Returns whether the given hashAlgorithm is valid
+ *
+ * @param hashAlgorithm the hashAlgorithm to check the validity of
+ * @return {@code true} if hashAlgorithm is valid, {@code false} if not
+ */
+ private boolean isValidHashAlgorithm(HashAlgorithmEnum hashAlgorithm) {
+ return hashAlgorithm != null;
+ }
+
+ /**
+ * Gets hashed value of the Issuer DN (Distinguished Name).
+ *
+ * @return Hashed value of the Issuer DN (Distinguished Name)
+ */
+ public String getIssuerNameHash() {
+ return issuerNameHash;
+ }
+
+ /**
+ * Sets hashed value of the Issuer DN (Distinguished Name).
+ *
+ * @param issuerNameHash Hashed value of the Issuer DN (Distinguished Name)
+ */
+ public void setIssuerNameHash(String issuerNameHash) {
+ if (!isValidIssuerNameHash(issuerNameHash)) {
+ throw new PropertyConstraintException(issuerNameHash, "issuerNameHash is invalid");
+ }
+ this.issuerNameHash = issuerNameHash;
+ }
+
+ /**
+ * Returns whether the given issuerNameHash is valid
+ *
+ * @param issuerNameHash the issuerNameHash to check the validity of
+ * @return {@code true} if issuerNameHash is valid, {@code false} if not
+ */
+ private boolean isValidIssuerNameHash(String issuerNameHash) {
+ return issuerNameHash != null && issuerNameHash.length() <= 128;
+ }
+
+ /**
+ * Gets hashed value of the issuers public key
+ *
+ * @return Hashed value of the issuers public key
+ */
+ public String getIssuerKeyHash() {
+ return issuerKeyHash;
+ }
+
+ /**
+ * Sets hashed value of the issuers public key
+ *
+ * @param issuerKeyHash Hashed value of the issuers public key
+ */
+ public void setIssuerKeyHash(String issuerKeyHash) {
+ if (!isValidIssuerKeyHash(issuerKeyHash)) {
+ throw new PropertyConstraintException(issuerKeyHash, "issuerKeyHash is invalid");
+ }
+ this.issuerKeyHash = issuerKeyHash;
+ }
+
+ /**
+ * Returns whether the given issuerKeyHash is valid
+ *
+ * @param issuerKeyHash the issuerKeyHash to check the validity of
+ * @return {@code true} if issuerKeyHash is valid, {@code false} if not
+ */
+ private boolean isValidIssuerKeyHash(String issuerKeyHash) {
+ return issuerKeyHash != null && issuerKeyHash.length() <= 128;
+ }
+
+ /**
+ * Gets the serial number of the certificate.
+ *
+ * @return The serial number of the certificate
+ */
+ public String getSerialNumber() {
+ return serialNumber;
+ }
+
+ /**
+ * Sets the serial number of the certificate.
+ *
+ * @param serialNumber The serial number of the certificate
+ */
+ public void setSerialNumber(String serialNumber) {
+ if (!isValidSerialNumber(serialNumber)) {
+ throw new PropertyConstraintException(serialNumber, "serialNumber is invalid");
+ }
+ this.serialNumber = serialNumber;
+ }
+
+ /**
+ * Returns whether the given serialNumber is valid
+ *
+ * @param serialNumber the serialNumber to check the validity of
+ * @return {@code true} if serialNumber is valid, {@code false} if not
+ */
+ private boolean isValidSerialNumber(String serialNumber) {
+ return serialNumber != null && serialNumber.length() <= 40;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidHashAlgorithm(hashAlgorithm)
+ && isValidIssuerNameHash(issuerNameHash)
+ && isValidIssuerKeyHash(issuerKeyHash)
+ && isValidSerialNumber(serialNumber);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CertificateHashData that = (CertificateHashData) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(hashAlgorithm, that.hashAlgorithm)
+ && Objects.equals(issuerNameHash, that.issuerNameHash)
+ && Objects.equals(issuerKeyHash, that.issuerKeyHash)
+ && Objects.equals(serialNumber, that.serialNumber);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, hashAlgorithm, issuerNameHash, issuerKeyHash, serialNumber);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("hashAlgorithm", hashAlgorithm)
+ .add("issuerNameHash", issuerNameHash)
+ .add("issuerKeyHash", issuerKeyHash)
+ .add("serialNumber", serialNumber)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateHashDataChain.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateHashDataChain.java
new file mode 100644
index 000000000..aa1155a95
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateHashDataChain.java
@@ -0,0 +1,255 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** CertificateHashDataChainType */
+public final class CertificateHashDataChain {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** certificateHashData */
+ private CertificateHashData certificateHashData;
+
+ /** The type of the requested certificate(s). */
+ private GetCertificateIdUseEnum certificateType;
+
+ /** childCertificateHashData */
+ @Nullable private CertificateHashData[] childCertificateHashData;
+
+ /**
+ * Constructor for the CertificateHashDataChain class
+ *
+ * @param certificateHashData certificateHashData
+ * @param certificateType The type of the requested certificate(s).
+ */
+ public CertificateHashDataChain(
+ CertificateHashData certificateHashData, GetCertificateIdUseEnum certificateType) {
+ setCertificateHashData(certificateHashData);
+ setCertificateType(certificateType);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public CertificateHashDataChain withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets certificateHashData
+ *
+ * @return certificateHashData
+ */
+ public CertificateHashData getCertificateHashData() {
+ return certificateHashData;
+ }
+
+ /**
+ * Sets certificateHashData
+ *
+ * @param certificateHashData certificateHashData
+ */
+ public void setCertificateHashData(CertificateHashData certificateHashData) {
+ if (!isValidCertificateHashData(certificateHashData)) {
+ throw new PropertyConstraintException(certificateHashData, "certificateHashData is invalid");
+ }
+ this.certificateHashData = certificateHashData;
+ }
+
+ /**
+ * Returns whether the given certificateHashData is valid
+ *
+ * @param certificateHashData the certificateHashData to check the validity of
+ * @return {@code true} if certificateHashData is valid, {@code false} if not
+ */
+ private boolean isValidCertificateHashData(CertificateHashData certificateHashData) {
+ return certificateHashData != null && certificateHashData.validate();
+ }
+
+ /**
+ * Gets the type of the requested certificate(s).
+ *
+ * @return The type of the requested certificate(s)
+ */
+ public GetCertificateIdUseEnum getCertificateType() {
+ return certificateType;
+ }
+
+ /**
+ * Sets the type of the requested certificate(s).
+ *
+ * @param certificateType The type of the requested certificate(s)
+ */
+ public void setCertificateType(GetCertificateIdUseEnum certificateType) {
+ if (!isValidCertificateType(certificateType)) {
+ throw new PropertyConstraintException(certificateType, "certificateType is invalid");
+ }
+ this.certificateType = certificateType;
+ }
+
+ /**
+ * Returns whether the given certificateType is valid
+ *
+ * @param certificateType the certificateType to check the validity of
+ * @return {@code true} if certificateType is valid, {@code false} if not
+ */
+ private boolean isValidCertificateType(GetCertificateIdUseEnum certificateType) {
+ return certificateType != null;
+ }
+
+ /**
+ * Gets childCertificateHashData
+ *
+ * @return childCertificateHashData
+ */
+ @Nullable
+ public CertificateHashData[] getChildCertificateHashData() {
+ return childCertificateHashData;
+ }
+
+ /**
+ * Sets childCertificateHashData
+ *
+ * @param childCertificateHashData childCertificateHashData
+ */
+ public void setChildCertificateHashData(
+ @Nullable CertificateHashData[] childCertificateHashData) {
+ if (!isValidChildCertificateHashData(childCertificateHashData)) {
+ throw new PropertyConstraintException(
+ childCertificateHashData, "childCertificateHashData is invalid");
+ }
+ this.childCertificateHashData = childCertificateHashData;
+ }
+
+ /**
+ * Returns whether the given childCertificateHashData is valid
+ *
+ * @param childCertificateHashData the childCertificateHashData to check the validity of
+ * @return {@code true} if childCertificateHashData is valid, {@code false} if not
+ */
+ private boolean isValidChildCertificateHashData(
+ @Nullable CertificateHashData[] childCertificateHashData) {
+ return childCertificateHashData == null
+ || (childCertificateHashData.length >= 1
+ && childCertificateHashData.length <= 4
+ && Arrays.stream(childCertificateHashData).allMatch(item -> item.validate()));
+ }
+
+ /**
+ * Adds childCertificateHashData
+ *
+ * @param childCertificateHashData childCertificateHashData
+ * @return this
+ */
+ public CertificateHashDataChain withChildCertificateHashData(
+ @Nullable CertificateHashData[] childCertificateHashData) {
+ setChildCertificateHashData(childCertificateHashData);
+ return this;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidCertificateHashData(certificateHashData)
+ && isValidCertificateType(certificateType)
+ && isValidChildCertificateHashData(childCertificateHashData);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CertificateHashDataChain that = (CertificateHashDataChain) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(certificateHashData, that.certificateHashData)
+ && Objects.equals(certificateType, that.certificateType)
+ && Arrays.equals(childCertificateHashData, that.childCertificateHashData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ customData,
+ certificateHashData,
+ certificateType,
+ Arrays.hashCode(childCertificateHashData));
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("certificateHashData", certificateHashData)
+ .add("certificateType", certificateType)
+ .add("childCertificateHashData", childCertificateHashData)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateSignedStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateSignedStatusEnum.java
new file mode 100644
index 000000000..c1fb84195
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateSignedStatusEnum.java
@@ -0,0 +1,31 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Returns whether certificate signing has been accepted, otherwise rejected. */
+public enum CertificateSignedStatusEnum {
+ Accepted,
+ Rejected
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateSigningUseEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateSigningUseEnum.java
new file mode 100644
index 000000000..557711316
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/CertificateSigningUseEnum.java
@@ -0,0 +1,34 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * The type of certificate that is to be signed. When omitted the certificate is to be used for both
+ * the 15118 connection (if implemented) and the Charging Station to CSMS connection.
+ */
+public enum CertificateSigningUseEnum {
+ ChargingStationCertificate,
+ V2GCertificate
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChangeAvailabilityStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChangeAvailabilityStatusEnum.java
new file mode 100644
index 000000000..0da34bc6b
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChangeAvailabilityStatusEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Whether the Charging Station is able to perform the availability change. */
+public enum ChangeAvailabilityStatusEnum {
+ Accepted,
+ Rejected,
+ Scheduled
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingLimit.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingLimit.java
new file mode 100644
index 000000000..44b418f52
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/ChargingLimit.java
@@ -0,0 +1,196 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Charging Limit */
+public final class ChargingLimit {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Charging Limit. Charging Limit Source. Charging Limit Source Code
+ *
+ *
+ * The severity levels have the following meaning: +
+ * *0-Danger* +
+ * Lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
+ * *1-Hardware Failure* +
+ * That the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
+ * *2-System Failure* +
+ * That the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
+ * *3-Critical* +
+ * A critical error. Action is required. +
+ * *4-Error* +
+ * A non-urgent error. Action is required. +
+ * *5-Alert* +
+ * An alert event. Default severity for any type of monitoring event. +
+ * *6-Warning* +
+ * A warning event. Action may be required. +
+ * *7-Notice* +
+ * An unusual event. No immediate action is required. +
+ * *8-Informational* +
+ * A regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
+ * *9-Debug* +
+ * Information useful to developers for debugging, not useful during operations.
+ *
+ */
+ private Integer severity;
+
+ /** A physical or logical component */
+ private Component component;
+
+ /** Reference key to a component-variable. */
+ private Variable variable;
+
+ /**
+ * Constructor for the SetMonitoringData class
+ *
+ * @param value Value for threshold or delta monitoring. For Periodic or PeriodicClockAligned this
+ * is the interval in seconds.
+ * @param type The type of this monitor, e.g. a threshold, delta or periodic monitor.
+ * @param severity The severity that will be assigned to an event that is triggered by this
+ * monitor. The severity range is 0-9, with 0 as the highest and 9 as the lowest severity
+ * level.
+ * @param component A physical or logical component
+ * @param variable Reference key to a component-variable.
+ */
+ public SetMonitoringData(
+ Double value, MonitorEnum type, Integer severity, Component component, Variable variable) {
+ setValue(value);
+ setType(type);
+ setSeverity(severity);
+ setComponent(component);
+ setVariable(variable);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetMonitoringData withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets an id SHALL only be given to replace an existing monitor. The Charging Station handles the
+ * generation of id's for new monitors.
+ *
+ * @return An id SHALL only be given to replace an existing monitor
+ */
+ @Nullable
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * Sets an id SHALL only be given to replace an existing monitor. The Charging Station handles the
+ * generation of id's for new monitors.
+ *
+ * @param id An id SHALL only be given to replace an existing monitor
+ */
+ public void setId(@Nullable Integer id) {
+ this.id = id;
+ }
+
+ /**
+ * Adds an id SHALL only be given to replace an existing monitor. The Charging Station handles the
+ * generation of id's for new monitors.
+ *
+ * @param id An id SHALL only be given to replace an existing monitor
+ * @return this
+ */
+ public SetMonitoringData withId(@Nullable Integer id) {
+ setId(id);
+ return this;
+ }
+
+ /**
+ * Gets monitor only active when a transaction is ongoing on a component relevant to this
+ * transaction. Default = false.
+ *
+ * @return Monitor only active when a transaction is ongoing on a component relevant to this
+ * transaction
+ */
+ public Boolean getTransaction() {
+ return transaction != null ? transaction : false;
+ }
+
+ /**
+ * Sets monitor only active when a transaction is ongoing on a component relevant to this
+ * transaction. Default = false.
+ *
+ * @param transaction Monitor only active when a transaction is ongoing on a component relevant to
+ * this transaction
+ */
+ public void setTransaction(@Nullable Boolean transaction) {
+ this.transaction = transaction;
+ }
+
+ /**
+ * Adds monitor only active when a transaction is ongoing on a component relevant to this
+ * transaction. Default = false.
+ *
+ * @param transaction Monitor only active when a transaction is ongoing on a component relevant to
+ * this transaction
+ * @return this
+ */
+ public SetMonitoringData withTransaction(@Nullable Boolean transaction) {
+ setTransaction(transaction);
+ return this;
+ }
+
+ /**
+ * Gets value for threshold or delta monitoring. For Periodic or PeriodicClockAligned this is the
+ * interval in seconds.
+ *
+ * @return Value for threshold or delta monitoring
+ */
+ public Double getValue() {
+ return value;
+ }
+
+ /**
+ * Sets value for threshold or delta monitoring. For Periodic or PeriodicClockAligned this is the
+ * interval in seconds.
+ *
+ * @param value Value for threshold or delta monitoring
+ */
+ public void setValue(Double value) {
+ if (!isValidValue(value)) {
+ throw new PropertyConstraintException(value, "value is invalid");
+ }
+ this.value = value;
+ }
+
+ /**
+ * Returns whether the given value is valid
+ *
+ * @param value the value to check the validity of
+ * @return {@code true} if value is valid, {@code false} if not
+ */
+ private boolean isValidValue(Double value) {
+ return value != null;
+ }
+
+ /**
+ * Gets the type of this monitor, e.g. a threshold, delta or periodic monitor.
+ *
+ * @return The type of this monitor, e.g. a threshold, delta or periodic monitor
+ */
+ public MonitorEnum getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type of this monitor, e.g. a threshold, delta or periodic monitor.
+ *
+ * @param type The type of this monitor, e.g. a threshold, delta or periodic monitor
+ */
+ public void setType(MonitorEnum type) {
+ if (!isValidType(type)) {
+ throw new PropertyConstraintException(type, "type is invalid");
+ }
+ this.type = type;
+ }
+
+ /**
+ * Returns whether the given type is valid
+ *
+ * @param type the type to check the validity of
+ * @return {@code true} if type is valid, {@code false} if not
+ */
+ private boolean isValidType(MonitorEnum type) {
+ return type != null;
+ }
+
+ /**
+ * Gets the severity that will be assigned to an event that is triggered by this monitor. The
+ * severity range is 0-9, with 0 as the highest and 9 as the lowest severity level.
+ *
+ * @return The severity that will be assigned to an event that is triggered by this monitor
+ */
+ public Integer getSeverity() {
+ return severity;
+ }
+
+ /**
+ * Sets the severity that will be assigned to an event that is triggered by this monitor. The
+ * severity range is 0-9, with 0 as the highest and 9 as the lowest severity level.
+ *
+ * @param severity The severity that will be assigned to an event that is triggered by this
+ * monitor
+ */
+ public void setSeverity(Integer severity) {
+ if (!isValidSeverity(severity)) {
+ throw new PropertyConstraintException(severity, "severity is invalid");
+ }
+ this.severity = severity;
+ }
+
+ /**
+ * Returns whether the given severity is valid
+ *
+ * @param severity the severity to check the validity of
+ * @return {@code true} if severity is valid, {@code false} if not
+ */
+ private boolean isValidSeverity(Integer severity) {
+ return severity != null;
+ }
+
+ /**
+ * Gets a physical or logical component
+ *
+ * @return A physical or logical component
+ */
+ public Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets a physical or logical component
+ *
+ * @param component A physical or logical component
+ */
+ public void setComponent(Component component) {
+ if (!isValidComponent(component)) {
+ throw new PropertyConstraintException(component, "component is invalid");
+ }
+ this.component = component;
+ }
+
+ /**
+ * Returns whether the given component is valid
+ *
+ * @param component the component to check the validity of
+ * @return {@code true} if component is valid, {@code false} if not
+ */
+ private boolean isValidComponent(Component component) {
+ return component != null && component.validate();
+ }
+
+ /**
+ * Gets reference key to a component-variable.
+ *
+ * @return Reference key to a component-variable
+ */
+ public Variable getVariable() {
+ return variable;
+ }
+
+ /**
+ * Sets reference key to a component-variable.
+ *
+ * @param variable Reference key to a component-variable
+ */
+ public void setVariable(Variable variable) {
+ if (!isValidVariable(variable)) {
+ throw new PropertyConstraintException(variable, "variable is invalid");
+ }
+ this.variable = variable;
+ }
+
+ /**
+ * Returns whether the given variable is valid
+ *
+ * @param variable the variable to check the validity of
+ * @return {@code true} if variable is valid, {@code false} if not
+ */
+ private boolean isValidVariable(Variable variable) {
+ return variable != null && variable.validate();
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidValue(value)
+ && isValidType(type)
+ && isValidSeverity(severity)
+ && isValidComponent(component)
+ && isValidVariable(variable);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetMonitoringData that = (SetMonitoringData) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(id, that.id)
+ && Objects.equals(transaction, that.transaction)
+ && Objects.equals(value, that.value)
+ && Objects.equals(type, that.type)
+ && Objects.equals(severity, that.severity)
+ && Objects.equals(component, that.component)
+ && Objects.equals(variable, that.variable);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, id, transaction, value, type, severity, component, variable);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("id", id)
+ .add("transaction", transaction)
+ .add("value", value)
+ .add("type", type)
+ .add("severity", severity)
+ .add("component", component)
+ .add("variable", variable)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetMonitoringResult.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetMonitoringResult.java
new file mode 100644
index 000000000..5a2276c0b
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetMonitoringResult.java
@@ -0,0 +1,447 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** Class to hold result of SetVariableMonitoring request. */
+public final class SetMonitoringResult {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /**
+ * Id given to the VariableMonitor by the Charging Station. The Id is only returned when status is
+ * accepted. Installed VariableMonitors should have unique id's but the id's of removed Installed
+ * monitors should have unique id's but the id's of removed monitors MAY be reused.
+ */
+ @Nullable private Integer id;
+
+ /** More information about the status. */
+ @Nullable private StatusInfo statusInfo;
+
+ /**
+ * Status is OK if a value could be returned. Otherwise this will indicate the reason why a value
+ * could not be returned.
+ */
+ private SetMonitoringStatusEnum status;
+
+ /** The type of this monitor, e.g. a threshold, delta or periodic monitor. */
+ private MonitorEnum type;
+
+ /** A physical or logical component */
+ private Component component;
+
+ /** Reference key to a component-variable. */
+ private Variable variable;
+
+ /**
+ * The severity that will be assigned to an event that is triggered by this monitor. The severity
+ * range is 0-9, with 0 as the highest and 9 as the lowest severity level.
+ *
+ *
+ * The severity levels have the following meaning: +
+ * *0-Danger* +
+ * Lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
+ * *1-Hardware Failure* +
+ * That the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
+ * *2-System Failure* +
+ * That the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
+ * *3-Critical* +
+ * A critical error. Action is required. +
+ * *4-Error* +
+ * A non-urgent error. Action is required. +
+ * *5-Alert* +
+ * An alert event. Default severity for any type of monitoring event. +
+ * *6-Warning* +
+ * A warning event. Action may be required. +
+ * *7-Notice* +
+ * An unusual event. No immediate action is required. +
+ * *8-Informational* +
+ * A regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
+ * *9-Debug* +
+ * Information useful to developers for debugging, not useful during operations.
+ *
+ */
+ private Integer severity;
+
+ /**
+ * Constructor for the SetMonitoringResult class
+ *
+ * @param status Status is OK if a value could be returned. Otherwise this will indicate the
+ * reason why a value could not be returned.
+ * @param type The type of this monitor, e.g. a threshold, delta or periodic monitor.
+ * @param component A physical or logical component
+ * @param variable Reference key to a component-variable.
+ * @param severity The severity that will be assigned to an event that is triggered by this
+ * monitor. The severity range is 0-9, with 0 as the highest and 9 as the lowest severity
+ * level.
+ */
+ public SetMonitoringResult(
+ SetMonitoringStatusEnum status,
+ MonitorEnum type,
+ Component component,
+ Variable variable,
+ Integer severity) {
+ setStatus(status);
+ setType(type);
+ setComponent(component);
+ setVariable(variable);
+ setSeverity(severity);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public SetMonitoringResult withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets id given to the VariableMonitor by the Charging Station. The Id is only returned when
+ * status is accepted. Installed VariableMonitors should have unique id's but the id's of removed
+ * Installed monitors should have unique id's but the id's of removed monitors MAY be reused.
+ *
+ * @return Id given to the VariableMonitor by the Charging Station
+ */
+ @Nullable
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * Sets id given to the VariableMonitor by the Charging Station. The Id is only returned when
+ * status is accepted. Installed VariableMonitors should have unique id's but the id's of removed
+ * Installed monitors should have unique id's but the id's of removed monitors MAY be reused.
+ *
+ * @param id Id given to the VariableMonitor by the Charging Station
+ */
+ public void setId(@Nullable Integer id) {
+ this.id = id;
+ }
+
+ /**
+ * Adds id given to the VariableMonitor by the Charging Station. The Id is only returned when
+ * status is accepted. Installed VariableMonitors should have unique id's but the id's of removed
+ * Installed monitors should have unique id's but the id's of removed monitors MAY be reused.
+ *
+ * @param id Id given to the VariableMonitor by the Charging Station
+ * @return this
+ */
+ public SetMonitoringResult withId(@Nullable Integer id) {
+ setId(id);
+ return this;
+ }
+
+ /**
+ * Gets more information about the status.
+ *
+ * @return More information about the status
+ */
+ @Nullable
+ public StatusInfo getStatusInfo() {
+ return statusInfo;
+ }
+
+ /**
+ * Sets more information about the status.
+ *
+ * @param statusInfo More information about the status
+ */
+ public void setStatusInfo(@Nullable StatusInfo statusInfo) {
+ if (!isValidStatusInfo(statusInfo)) {
+ throw new PropertyConstraintException(statusInfo, "statusInfo is invalid");
+ }
+ this.statusInfo = statusInfo;
+ }
+
+ /**
+ * Returns whether the given statusInfo is valid
+ *
+ * @param statusInfo the statusInfo to check the validity of
+ * @return {@code true} if statusInfo is valid, {@code false} if not
+ */
+ private boolean isValidStatusInfo(@Nullable StatusInfo statusInfo) {
+ return statusInfo == null || statusInfo.validate();
+ }
+
+ /**
+ * Adds more information about the status.
+ *
+ * @param statusInfo More information about the status
+ * @return this
+ */
+ public SetMonitoringResult withStatusInfo(@Nullable StatusInfo statusInfo) {
+ setStatusInfo(statusInfo);
+ return this;
+ }
+
+ /**
+ * Gets status is OK if a value could be returned. Otherwise this will indicate the reason why a
+ * value could not be returned.
+ *
+ * @return Status is OK if a value could be returned
+ */
+ public SetMonitoringStatusEnum getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets status is OK if a value could be returned. Otherwise this will indicate the reason why a
+ * value could not be returned.
+ *
+ * @param status Status is OK if a value could be returned
+ */
+ public void setStatus(SetMonitoringStatusEnum status) {
+ if (!isValidStatus(status)) {
+ throw new PropertyConstraintException(status, "status is invalid");
+ }
+ this.status = status;
+ }
+
+ /**
+ * Returns whether the given status is valid
+ *
+ * @param status the status to check the validity of
+ * @return {@code true} if status is valid, {@code false} if not
+ */
+ private boolean isValidStatus(SetMonitoringStatusEnum status) {
+ return status != null;
+ }
+
+ /**
+ * Gets the type of this monitor, e.g. a threshold, delta or periodic monitor.
+ *
+ * @return The type of this monitor, e.g. a threshold, delta or periodic monitor
+ */
+ public MonitorEnum getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type of this monitor, e.g. a threshold, delta or periodic monitor.
+ *
+ * @param type The type of this monitor, e.g. a threshold, delta or periodic monitor
+ */
+ public void setType(MonitorEnum type) {
+ if (!isValidType(type)) {
+ throw new PropertyConstraintException(type, "type is invalid");
+ }
+ this.type = type;
+ }
+
+ /**
+ * Returns whether the given type is valid
+ *
+ * @param type the type to check the validity of
+ * @return {@code true} if type is valid, {@code false} if not
+ */
+ private boolean isValidType(MonitorEnum type) {
+ return type != null;
+ }
+
+ /**
+ * Gets a physical or logical component
+ *
+ * @return A physical or logical component
+ */
+ public Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets a physical or logical component
+ *
+ * @param component A physical or logical component
+ */
+ public void setComponent(Component component) {
+ if (!isValidComponent(component)) {
+ throw new PropertyConstraintException(component, "component is invalid");
+ }
+ this.component = component;
+ }
+
+ /**
+ * Returns whether the given component is valid
+ *
+ * @param component the component to check the validity of
+ * @return {@code true} if component is valid, {@code false} if not
+ */
+ private boolean isValidComponent(Component component) {
+ return component != null && component.validate();
+ }
+
+ /**
+ * Gets reference key to a component-variable.
+ *
+ * @return Reference key to a component-variable
+ */
+ public Variable getVariable() {
+ return variable;
+ }
+
+ /**
+ * Sets reference key to a component-variable.
+ *
+ * @param variable Reference key to a component-variable
+ */
+ public void setVariable(Variable variable) {
+ if (!isValidVariable(variable)) {
+ throw new PropertyConstraintException(variable, "variable is invalid");
+ }
+ this.variable = variable;
+ }
+
+ /**
+ * Returns whether the given variable is valid
+ *
+ * @param variable the variable to check the validity of
+ * @return {@code true} if variable is valid, {@code false} if not
+ */
+ private boolean isValidVariable(Variable variable) {
+ return variable != null && variable.validate();
+ }
+
+ /**
+ * Gets the severity that will be assigned to an event that is triggered by this monitor. The
+ * severity range is 0-9, with 0 as the highest and 9 as the lowest severity level.
+ *
+ * @return The severity that will be assigned to an event that is triggered by this monitor
+ */
+ public Integer getSeverity() {
+ return severity;
+ }
+
+ /**
+ * Sets the severity that will be assigned to an event that is triggered by this monitor. The
+ * severity range is 0-9, with 0 as the highest and 9 as the lowest severity level.
+ *
+ * @param severity The severity that will be assigned to an event that is triggered by this
+ * monitor
+ */
+ public void setSeverity(Integer severity) {
+ if (!isValidSeverity(severity)) {
+ throw new PropertyConstraintException(severity, "severity is invalid");
+ }
+ this.severity = severity;
+ }
+
+ /**
+ * Returns whether the given severity is valid
+ *
+ * @param severity the severity to check the validity of
+ * @return {@code true} if severity is valid, {@code false} if not
+ */
+ private boolean isValidSeverity(Integer severity) {
+ return severity != null;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidStatusInfo(statusInfo)
+ && isValidStatus(status)
+ && isValidType(type)
+ && isValidComponent(component)
+ && isValidVariable(variable)
+ && isValidSeverity(severity);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SetMonitoringResult that = (SetMonitoringResult) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(id, that.id)
+ && Objects.equals(statusInfo, that.statusInfo)
+ && Objects.equals(status, that.status)
+ && Objects.equals(type, that.type)
+ && Objects.equals(component, that.component)
+ && Objects.equals(variable, that.variable)
+ && Objects.equals(severity, that.severity);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, id, statusInfo, status, type, component, variable, severity);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("id", id)
+ .add("statusInfo", statusInfo)
+ .add("status", status)
+ .add("type", type)
+ .add("component", component)
+ .add("variable", variable)
+ .add("severity", severity)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetMonitoringStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetMonitoringStatusEnum.java
new file mode 100644
index 000000000..7252689e7
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetMonitoringStatusEnum.java
@@ -0,0 +1,38 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/**
+ * Status is OK if a value could be returned. Otherwise this will indicate the reason why a value
+ * could not be returned.
+ */
+public enum SetMonitoringStatusEnum {
+ Accepted,
+ UnknownComponent,
+ UnknownVariable,
+ UnsupportedMonitorType,
+ Rejected,
+ Duplicate
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetNetworkProfileStatusEnum.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetNetworkProfileStatusEnum.java
new file mode 100644
index 000000000..a2858f55b
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetNetworkProfileStatusEnum.java
@@ -0,0 +1,32 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+/** Result of operation. */
+public enum SetNetworkProfileStatusEnum {
+ Accepted,
+ Rejected,
+ Failed
+}
diff --git a/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetVariableData.java b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetVariableData.java
new file mode 100644
index 000000000..c12cf96ef
--- /dev/null
+++ b/ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model/types/SetVariableData.java
@@ -0,0 +1,272 @@
+/*
+ ChargeTime.eu - Java-OCA-OCPP
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+package eu.chargetime.ocpp.v201.model.types;
+
+import eu.chargetime.ocpp.PropertyConstraintException;
+import eu.chargetime.ocpp.utilities.MoreObjects;
+import java.util.Objects;
+import javax.annotation.Nullable;
+
+/** SetVariableDataType */
+public final class SetVariableData {
+ /** Custom data */
+ @Nullable private CustomData customData;
+
+ /** Type of attribute: Actual, Target, MinSet, MaxSet. Default is Actual when omitted. */
+ @Nullable private AttributeEnum attributeType;
+
+ /**
+ * Value to be assigned to attribute of variable.
+ *
+ *
+ * The severity levels have the following meaning: +
+ * *0-Danger* +
+ * Lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
+ * *1-Hardware Failure* +
+ * That the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
+ * *2-System Failure* +
+ * That the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
+ * *3-Critical* +
+ * A critical error. Action is required. +
+ * *4-Error* +
+ * A non-urgent error. Action is required. +
+ * *5-Alert* +
+ * An alert event. Default severity for any type of monitoring event. +
+ * *6-Warning* +
+ * A warning event. Action may be required. +
+ * *7-Notice* +
+ * An unusual event. No immediate action is required. +
+ * *8-Informational* +
+ * A regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
+ * *9-Debug* +
+ * Information useful to developers for debugging, not useful during operations.
+ *
+ */
+ private Integer severity;
+
+ /**
+ * Constructor for the VariableMonitoring class
+ *
+ * @param id The identifier of the monitor.
+ * @param transaction Monitor only active when a transaction is ongoing on a component relevant to
+ * this transaction.
+ * @param value Value for threshold or delta monitoring. For Periodic or PeriodicClockAligned this
+ * is the interval in seconds.
+ * @param type The type of this monitor, e.g. a threshold, delta or periodic monitor.
+ * @param severity The severity that will be assigned to an event that is triggered by this
+ * monitor. The severity range is 0-9, with 0 as the highest and 9 as the lowest severity
+ * level.
+ */
+ public VariableMonitoring(
+ Integer id, Boolean transaction, Double value, MonitorEnum type, Integer severity) {
+ setId(id);
+ setTransaction(transaction);
+ setValue(value);
+ setType(type);
+ setSeverity(severity);
+ }
+
+ /**
+ * Gets custom data
+ *
+ * @return Custom data
+ */
+ @Nullable
+ public CustomData getCustomData() {
+ return customData;
+ }
+
+ /**
+ * Sets custom data
+ *
+ * @param customData Custom data
+ */
+ public void setCustomData(@Nullable CustomData customData) {
+ if (!isValidCustomData(customData)) {
+ throw new PropertyConstraintException(customData, "customData is invalid");
+ }
+ this.customData = customData;
+ }
+
+ /**
+ * Returns whether the given customData is valid
+ *
+ * @param customData the customData to check the validity of
+ * @return {@code true} if customData is valid, {@code false} if not
+ */
+ private boolean isValidCustomData(@Nullable CustomData customData) {
+ return customData == null || customData.validate();
+ }
+
+ /**
+ * Adds custom data
+ *
+ * @param customData Custom data
+ * @return this
+ */
+ public VariableMonitoring withCustomData(@Nullable CustomData customData) {
+ setCustomData(customData);
+ return this;
+ }
+
+ /**
+ * Gets the identifier of the monitor.
+ *
+ * @return The identifier of the monitor
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * Sets the identifier of the monitor.
+ *
+ * @param id The identifier of the monitor
+ */
+ public void setId(Integer id) {
+ if (!isValidId(id)) {
+ throw new PropertyConstraintException(id, "id is invalid");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Returns whether the given id is valid
+ *
+ * @param id the id to check the validity of
+ * @return {@code true} if id is valid, {@code false} if not
+ */
+ private boolean isValidId(Integer id) {
+ return id != null;
+ }
+
+ /**
+ * Gets monitor only active when a transaction is ongoing on a component relevant to this
+ * transaction.
+ *
+ * @return Monitor only active when a transaction is ongoing on a component relevant to this
+ * transaction
+ */
+ public Boolean getTransaction() {
+ return transaction;
+ }
+
+ /**
+ * Sets monitor only active when a transaction is ongoing on a component relevant to this
+ * transaction.
+ *
+ * @param transaction Monitor only active when a transaction is ongoing on a component relevant to
+ * this transaction
+ */
+ public void setTransaction(Boolean transaction) {
+ if (!isValidTransaction(transaction)) {
+ throw new PropertyConstraintException(transaction, "transaction is invalid");
+ }
+ this.transaction = transaction;
+ }
+
+ /**
+ * Returns whether the given transaction is valid
+ *
+ * @param transaction the transaction to check the validity of
+ * @return {@code true} if transaction is valid, {@code false} if not
+ */
+ private boolean isValidTransaction(Boolean transaction) {
+ return transaction != null;
+ }
+
+ /**
+ * Gets value for threshold or delta monitoring. For Periodic or PeriodicClockAligned this is the
+ * interval in seconds.
+ *
+ * @return Value for threshold or delta monitoring
+ */
+ public Double getValue() {
+ return value;
+ }
+
+ /**
+ * Sets value for threshold or delta monitoring. For Periodic or PeriodicClockAligned this is the
+ * interval in seconds.
+ *
+ * @param value Value for threshold or delta monitoring
+ */
+ public void setValue(Double value) {
+ if (!isValidValue(value)) {
+ throw new PropertyConstraintException(value, "value is invalid");
+ }
+ this.value = value;
+ }
+
+ /**
+ * Returns whether the given value is valid
+ *
+ * @param value the value to check the validity of
+ * @return {@code true} if value is valid, {@code false} if not
+ */
+ private boolean isValidValue(Double value) {
+ return value != null;
+ }
+
+ /**
+ * Gets the type of this monitor, e.g. a threshold, delta or periodic monitor.
+ *
+ * @return The type of this monitor, e.g. a threshold, delta or periodic monitor
+ */
+ public MonitorEnum getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type of this monitor, e.g. a threshold, delta or periodic monitor.
+ *
+ * @param type The type of this monitor, e.g. a threshold, delta or periodic monitor
+ */
+ public void setType(MonitorEnum type) {
+ if (!isValidType(type)) {
+ throw new PropertyConstraintException(type, "type is invalid");
+ }
+ this.type = type;
+ }
+
+ /**
+ * Returns whether the given type is valid
+ *
+ * @param type the type to check the validity of
+ * @return {@code true} if type is valid, {@code false} if not
+ */
+ private boolean isValidType(MonitorEnum type) {
+ return type != null;
+ }
+
+ /**
+ * Gets the severity that will be assigned to an event that is triggered by this monitor. The
+ * severity range is 0-9, with 0 as the highest and 9 as the lowest severity level.
+ *
+ * @return The severity that will be assigned to an event that is triggered by this monitor
+ */
+ public Integer getSeverity() {
+ return severity;
+ }
+
+ /**
+ * Sets the severity that will be assigned to an event that is triggered by this monitor. The
+ * severity range is 0-9, with 0 as the highest and 9 as the lowest severity level.
+ *
+ * @param severity The severity that will be assigned to an event that is triggered by this
+ * monitor
+ */
+ public void setSeverity(Integer severity) {
+ if (!isValidSeverity(severity)) {
+ throw new PropertyConstraintException(severity, "severity is invalid");
+ }
+ this.severity = severity;
+ }
+
+ /**
+ * Returns whether the given severity is valid
+ *
+ * @param severity the severity to check the validity of
+ * @return {@code true} if severity is valid, {@code false} if not
+ */
+ private boolean isValidSeverity(Integer severity) {
+ return severity != null;
+ }
+
+ public boolean validate() {
+ return isValidCustomData(customData)
+ && isValidId(id)
+ && isValidTransaction(transaction)
+ && isValidValue(value)
+ && isValidType(type)
+ && isValidSeverity(severity);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ VariableMonitoring that = (VariableMonitoring) o;
+ return Objects.equals(customData, that.customData)
+ && Objects.equals(id, that.id)
+ && Objects.equals(transaction, that.transaction)
+ && Objects.equals(value, that.value)
+ && Objects.equals(type, that.type)
+ && Objects.equals(severity, that.severity);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(customData, id, transaction, value, type, severity);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("customData", customData)
+ .add("id", id)
+ .add("transaction", transaction)
+ .add("value", value)
+ .add("type", type)
+ .add("severity", severity)
+ .add("isValid", validate())
+ .toString();
+ }
+}
diff --git a/ocpp-v2/src/test/java/eu/chargetime/ocpp/v201/model/messages/BootNotificationRequestTest.java b/ocpp-v2/src/test/java/eu/chargetime/ocpp/v201/model/messages/BootNotificationRequestTest.java
new file mode 100644
index 000000000..08ce2b571
--- /dev/null
+++ b/ocpp-v2/src/test/java/eu/chargetime/ocpp/v201/model/messages/BootNotificationRequestTest.java
@@ -0,0 +1,67 @@
+/*
+ * ChargeTime.eu - Java-OCA-OCPP
+ *
+ * Copyright (C) 2023 Robert Schlabbach (robert.schlabbach@ubitricity.com)
+ *
+ * MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package eu.chargetime.ocpp.v201.model.messages;
+
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+import eu.chargetime.ocpp.JSONCommunicator;
+import eu.chargetime.ocpp.v201.model.types.BootReasonEnum;
+import eu.chargetime.ocpp.v201.model.types.ChargingStation;
+import eu.chargetime.ocpp.v201.model.types.Modem;
+import org.junit.Test;
+
+/** unit tests for OCPP 2.0.1 BootNotificationRequest serialization and deserialization */
+public class BootNotificationRequestTest {
+ @Test
+ public void testSerializationAndDeserialization() throws Exception {
+ JSONCommunicator communicator = new JSONCommunicator(null);
+ BootNotificationRequest originalRequest =
+ new BootNotificationRequest(
+ new ChargingStation("model", "vendor")
+ .withSerialNumber("123456789")
+ .withFirmwareVersion("0.0.1")
+ .withModem(new Modem().withImsi("1851").withIccid("16610")),
+ BootReasonEnum.Unknown);
+ String json = communicator.packPayload(originalRequest).toString();
+ BootNotificationRequest deserializedRequest =
+ communicator.unpackPayload(json, BootNotificationRequest.class);
+ assertThat(deserializedRequest, notNullValue());
+ assertThat(deserializedRequest, is(originalRequest));
+ }
+
+ @Test
+ public void testInvalidBootNotificationCanBeDeserialized() throws Exception {
+ JSONCommunicator communicator = new JSONCommunicator(null);
+ String json = "{}";
+ BootNotificationRequest bootNotificationRequest =
+ communicator.unpackPayload(json, BootNotificationRequest.class);
+ assertThat(bootNotificationRequest, notNullValue());
+ assertThat(bootNotificationRequest.validate(), is(false));
+ }
+}
diff --git a/ocpp-v2_0-test/pom.xml b/ocpp-v2_0-test/pom.xml
index 82a829d4d..b5f24fe32 100644
--- a/ocpp-v2_0-test/pom.xml
+++ b/ocpp-v2_0-test/pom.xml
@@ -6,7 +6,7 @@