// @generated by `cargo xtask codegen` from the vendored OCPP JSON schemas.
// DO NOT EDIT — re-run the generator instead. CI fails if this file is stale.
//! Request and response payloads for every OCPP 2.1 action.
#![allow(unused_imports, clippy::doc_markdown, clippy::struct_excessive_bools)]
#![allow(
clippy::too_many_lines,
clippy::too_many_arguments,
clippy::wildcard_imports
)]
#![allow(clippy::match_same_arms, clippy::fn_params_excessive_bools)]
use alloc::string::String;
use alloc::vec::Vec;
use serde::{Deserialize, Serialize};
use super::action::Action;
use super::enums::*;
use super::types::*;
use crate::message::{Confirmed, MessageKind, Origin, Request, Response, Sealed, Unconfirmed};
use crate::validate::{self, Validate, ValidationPath, Violations};
/// Spec: OCPP 2.1 · Q — Bidirectional Power Transfer · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AFRRSignalRequest {
/// Time when signal becomes active.
pub timestamp: crate::types::DateTime,
/// Value of signal in _v2xSignalWattCurve_.
#[serde(deserialize_with = "crate::types::integer::one")]
pub signal: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl AFRRSignalRequest {
/// Creates a `AFRRSignalRequest` from its required fields.
#[must_use]
pub fn new(timestamp: impl Into<crate::types::DateTime>, signal: i32) -> Self {
Self {
timestamp: timestamp.into(),
signal,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for AFRRSignalRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for AFRRSignalRequest {}
impl Request for AFRRSignalRequest {
type Action = Action;
const ACTION: Action = Action::AFRRSignal;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = AFRRSignalResponse;
}
impl Confirmed for AFRRSignalRequest {}
/// Spec: OCPP 2.1 · Q — Bidirectional Power Transfer · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AFRRSignalResponse {
/// The `status` member.
pub status: GenericStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl AFRRSignalResponse {
/// Creates a `AFRRSignalResponse` from its required fields.
#[must_use]
pub fn new(status: GenericStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for AFRRSignalResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for AFRRSignalResponse {}
impl Response for AFRRSignalResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AdjustPeriodicEventStreamRequest {
/// The `id` member.
#[serde(deserialize_with = "crate::types::integer::one")]
pub id: i32,
/// The `params` member.
pub params: PeriodicEventStreamParams,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl AdjustPeriodicEventStreamRequest {
/// Creates a `AdjustPeriodicEventStreamRequest` from its required fields.
#[must_use]
pub fn new(id: i32, params: PeriodicEventStreamParams) -> Self {
Self {
id,
params,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for AdjustPeriodicEventStreamRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("id");
validate::int_range(i64::from(self.id), Some(0), None, path, out);
path.pop();
path.push_key("params");
Validate::validate_at(&self.params, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for AdjustPeriodicEventStreamRequest {}
impl Request for AdjustPeriodicEventStreamRequest {
type Action = Action;
const ACTION: Action = Action::AdjustPeriodicEventStream;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = AdjustPeriodicEventStreamResponse;
}
impl Confirmed for AdjustPeriodicEventStreamRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AdjustPeriodicEventStreamResponse {
/// The `status` member.
pub status: GenericStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl AdjustPeriodicEventStreamResponse {
/// Creates a `AdjustPeriodicEventStreamResponse` from its required fields.
#[must_use]
pub fn new(status: GenericStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for AdjustPeriodicEventStreamResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for AdjustPeriodicEventStreamResponse {}
impl Response for AdjustPeriodicEventStreamResponse {}
/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AuthorizeRequest {
/// The `idToken` member.
#[serde(rename = "idToken")]
pub id_token: IdToken,
/// *(2.1)* The X.509 certificate chain presented by EV and encoded in PEM format. Order of certificates in chain is from leaf up to (but excluding) root certificate. +
/// Only needed in case of central contract validation when Charging Station cannot validate the contract certificate.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub certificate: Option<String>,
/// The `iso15118CertificateHashData` member.
#[serde(rename = "iso15118CertificateHashData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub iso15118_certificate_hash_data: Option<Vec<OCSPRequestData>>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl AuthorizeRequest {
/// Creates a `AuthorizeRequest` from its required fields.
#[must_use]
pub fn new(id_token: IdToken) -> Self {
Self {
id_token,
certificate: None,
iso15118_certificate_hash_data: None,
custom_data: None,
}
}
/// Sets the optional `certificate` field.
#[must_use]
pub fn with_certificate(mut self, value: impl Into<String>) -> Self {
self.certificate = Some(value.into());
self
}
/// Sets the optional `iso15118CertificateHashData` field.
#[must_use]
pub fn with_iso15118_certificate_hash_data(mut self, value: Vec<OCSPRequestData>) -> Self {
self.iso15118_certificate_hash_data = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for AuthorizeRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idToken");
Validate::validate_at(&self.id_token, path, out);
path.pop();
path.push_key("certificate");
if let Some(value) = &self.certificate {
validate::string(value.as_str(), None, Some(10000), path, out);
}
path.pop();
path.push_key("iso15118CertificateHashData");
if let Some(value) = &self.iso15118_certificate_hash_data {
validate::list_len(value.len(), Some(1), Some(4), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for AuthorizeRequest {}
impl Request for AuthorizeRequest {
type Action = Action;
const ACTION: Action = Action::Authorize;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = AuthorizeResponse;
}
impl Confirmed for AuthorizeRequest {}
/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AuthorizeResponse {
/// The `idTokenInfo` member.
#[serde(rename = "idTokenInfo")]
pub id_token_info: IdTokenInfo,
/// The `certificateStatus` member.
#[serde(rename = "certificateStatus")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub certificate_status: Option<AuthorizeCertificateStatus>,
/// *(2.1)* List of allowed energy transfer modes the EV can choose from. If omitted this defaults to charging only.
#[serde(rename = "allowedEnergyTransfer")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub allowed_energy_transfer: Option<Vec<EnergyTransferMode>>,
/// The `tariff` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tariff: Option<Tariff>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl AuthorizeResponse {
/// Creates a `AuthorizeResponse` from its required fields.
#[must_use]
pub fn new(id_token_info: IdTokenInfo) -> Self {
Self {
id_token_info,
certificate_status: None,
allowed_energy_transfer: None,
tariff: None,
custom_data: None,
}
}
/// Sets the optional `certificateStatus` field.
#[must_use]
pub fn with_certificate_status(mut self, value: AuthorizeCertificateStatus) -> Self {
self.certificate_status = Some(value);
self
}
/// Sets the optional `allowedEnergyTransfer` field.
#[must_use]
pub fn with_allowed_energy_transfer(mut self, value: Vec<EnergyTransferMode>) -> Self {
self.allowed_energy_transfer = Some(value);
self
}
/// Sets the optional `tariff` field.
#[must_use]
pub fn with_tariff(mut self, value: Tariff) -> Self {
self.tariff = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for AuthorizeResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idTokenInfo");
Validate::validate_at(&self.id_token_info, path, out);
path.pop();
path.push_key("certificateStatus");
if let Some(value) = &self.certificate_status {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("allowedEnergyTransfer");
if let Some(value) = &self.allowed_energy_transfer {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("tariff");
if let Some(value) = &self.tariff {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for AuthorizeResponse {}
impl Response for AuthorizeResponse {}
/// Spec: OCPP 2.1 · S — Battery Swapping · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct BatterySwapRequest {
/// The `batteryData` member.
#[serde(rename = "batteryData")]
pub battery_data: Vec<BatteryData>,
/// The `eventType` member.
#[serde(rename = "eventType")]
pub event_type: BatterySwapEvent,
/// The `idToken` member.
#[serde(rename = "idToken")]
pub id_token: IdToken,
/// RequestId to correlate BatteryIn/Out events and optional RequestBatterySwapRequest.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl BatterySwapRequest {
/// Creates a `BatterySwapRequest` from its required fields.
#[must_use]
pub fn new(
battery_data: Vec<BatteryData>,
event_type: BatterySwapEvent,
id_token: IdToken,
request_id: i32,
) -> Self {
Self {
battery_data,
event_type,
id_token,
request_id,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for BatterySwapRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("batteryData");
validate::list_len(self.battery_data.len(), Some(1), None, path, out);
for (index, item) in self.battery_data.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("eventType");
Validate::validate_at(&self.event_type, path, out);
path.pop();
path.push_key("idToken");
Validate::validate_at(&self.id_token, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for BatterySwapRequest {}
impl Request for BatterySwapRequest {
type Action = Action;
const ACTION: Action = Action::BatterySwap;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = BatterySwapResponse;
}
impl Confirmed for BatterySwapRequest {}
/// This is an empty response that just acknowledges receipt of the request. (The request cannot be rejected).
///
/// Spec: OCPP 2.1 · S — Battery Swapping · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct BatterySwapResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl BatterySwapResponse {
/// Creates an empty `BatterySwapResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for BatterySwapResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for BatterySwapResponse {}
impl Response for BatterySwapResponse {}
/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct BootNotificationRequest {
/// The `chargingStation` member.
#[serde(rename = "chargingStation")]
pub charging_station: ChargingStation,
/// The `reason` member.
pub reason: BootReason,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl BootNotificationRequest {
/// Creates a `BootNotificationRequest` from its required fields.
#[must_use]
pub fn new(charging_station: ChargingStation, reason: BootReason) -> Self {
Self {
charging_station,
reason,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for BootNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("chargingStation");
Validate::validate_at(&self.charging_station, path, out);
path.pop();
path.push_key("reason");
Validate::validate_at(&self.reason, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for BootNotificationRequest {}
impl Request for BootNotificationRequest {
type Action = Action;
const ACTION: Action = Action::BootNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = BootNotificationResponse;
}
impl Confirmed for BootNotificationRequest {}
/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct BootNotificationResponse {
/// This contains the CSMS’s current time.
#[serde(rename = "currentTime")]
pub current_time: crate::types::DateTime,
/// When <<cmn_registrationstatusenumtype,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.
#[serde(deserialize_with = "crate::types::integer::one")]
pub interval: i32,
/// The `status` member.
pub status: RegistrationStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl BootNotificationResponse {
/// Creates a `BootNotificationResponse` from its required fields.
#[must_use]
pub fn new(
current_time: impl Into<crate::types::DateTime>,
interval: i32,
status: RegistrationStatus,
) -> Self {
Self {
current_time: current_time.into(),
interval,
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for BootNotificationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for BootNotificationResponse {}
impl Response for BootNotificationResponse {}
/// Spec: OCPP 2.1 · H — Reservation · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CancelReservationRequest {
/// Id of the reservation to cancel.
#[serde(rename = "reservationId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub reservation_id: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl CancelReservationRequest {
/// Creates a `CancelReservationRequest` from its required fields.
#[must_use]
pub fn new(reservation_id: i32) -> Self {
Self {
reservation_id,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for CancelReservationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("reservationId");
validate::int_range(i64::from(self.reservation_id), Some(0), None, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for CancelReservationRequest {}
impl Request for CancelReservationRequest {
type Action = Action;
const ACTION: Action = Action::CancelReservation;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = CancelReservationResponse;
}
impl Confirmed for CancelReservationRequest {}
/// Spec: OCPP 2.1 · H — Reservation · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CancelReservationResponse {
/// The `status` member.
pub status: CancelReservationStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl CancelReservationResponse {
/// Creates a `CancelReservationResponse` from its required fields.
#[must_use]
pub fn new(status: CancelReservationStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for CancelReservationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for CancelReservationResponse {}
impl Response for CancelReservationResponse {}
/// Spec: OCPP 2.1 · A — Security · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CertificateSignedRequest {
/// The signed PEM encoded X.509 certificate. This SHALL also contain the necessary sub CA certificates, when applicable. The order of the bundle follows the certificate chain, starting from the leaf certificate.
///
/// The Configuration Variable <<configkey-max-certificate-chain-size,MaxCertificateChainSize>> can be used to limit the maximum size of this field.
#[serde(rename = "certificateChain")]
pub certificate_chain: String,
/// The `certificateType` member.
#[serde(rename = "certificateType")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub certificate_type: Option<CertificateSigningUse>,
/// *(2.1)* RequestId to correlate this message with the SignCertificateRequest.
#[serde(rename = "requestId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub request_id: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl CertificateSignedRequest {
/// Creates a `CertificateSignedRequest` from its required fields.
#[must_use]
pub fn new(certificate_chain: impl Into<String>) -> Self {
Self {
certificate_chain: certificate_chain.into(),
certificate_type: None,
request_id: None,
custom_data: None,
}
}
/// Sets the optional `certificateType` field.
#[must_use]
pub fn with_certificate_type(mut self, value: CertificateSigningUse) -> Self {
self.certificate_type = Some(value);
self
}
/// Sets the optional `requestId` field.
#[must_use]
pub fn with_request_id(mut self, value: i32) -> Self {
self.request_id = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for CertificateSignedRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("certificateChain");
validate::string(
self.certificate_chain.as_str(),
None,
Some(10000),
path,
out,
);
path.pop();
path.push_key("certificateType");
if let Some(value) = &self.certificate_type {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for CertificateSignedRequest {}
impl Request for CertificateSignedRequest {
type Action = Action;
const ACTION: Action = Action::CertificateSigned;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = CertificateSignedResponse;
}
impl Confirmed for CertificateSignedRequest {}
/// Spec: OCPP 2.1 · A — Security · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CertificateSignedResponse {
/// The `status` member.
pub status: CertificateSignedStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl CertificateSignedResponse {
/// Creates a `CertificateSignedResponse` from its required fields.
#[must_use]
pub fn new(status: CertificateSignedStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for CertificateSignedResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for CertificateSignedResponse {}
impl Response for CertificateSignedResponse {}
/// Spec: OCPP 2.1 · G — Availability · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ChangeAvailabilityRequest {
/// The `operationalStatus` member.
#[serde(rename = "operationalStatus")]
pub operational_status: OperationalStatus,
/// The `evse` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub evse: Option<EVSE>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ChangeAvailabilityRequest {
/// Creates a `ChangeAvailabilityRequest` from its required fields.
#[must_use]
pub fn new(operational_status: OperationalStatus) -> Self {
Self {
operational_status,
evse: None,
custom_data: None,
}
}
/// Sets the optional `evse` field.
#[must_use]
pub fn with_evse(mut self, value: EVSE) -> Self {
self.evse = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ChangeAvailabilityRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("operationalStatus");
Validate::validate_at(&self.operational_status, path, out);
path.pop();
path.push_key("evse");
if let Some(value) = &self.evse {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ChangeAvailabilityRequest {}
impl Request for ChangeAvailabilityRequest {
type Action = Action;
const ACTION: Action = Action::ChangeAvailability;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ChangeAvailabilityResponse;
}
impl Confirmed for ChangeAvailabilityRequest {}
/// Spec: OCPP 2.1 · G — Availability · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ChangeAvailabilityResponse {
/// The `status` member.
pub status: ChangeAvailabilityStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ChangeAvailabilityResponse {
/// Creates a `ChangeAvailabilityResponse` from its required fields.
#[must_use]
pub fn new(status: ChangeAvailabilityStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ChangeAvailabilityResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ChangeAvailabilityResponse {}
impl Response for ChangeAvailabilityResponse {}
/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ChangeTransactionTariffRequest {
/// The `tariff` member.
pub tariff: Tariff,
/// Transaction id for new tariff.
#[serde(rename = "transactionId")]
pub transaction_id: String,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ChangeTransactionTariffRequest {
/// Creates a `ChangeTransactionTariffRequest` from its required fields.
#[must_use]
pub fn new(tariff: Tariff, transaction_id: impl Into<String>) -> Self {
Self {
tariff,
transaction_id: transaction_id.into(),
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ChangeTransactionTariffRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("tariff");
Validate::validate_at(&self.tariff, path, out);
path.pop();
path.push_key("transactionId");
validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ChangeTransactionTariffRequest {}
impl Request for ChangeTransactionTariffRequest {
type Action = Action;
const ACTION: Action = Action::ChangeTransactionTariff;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ChangeTransactionTariffResponse;
}
impl Confirmed for ChangeTransactionTariffRequest {}
/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ChangeTransactionTariffResponse {
/// The `status` member.
pub status: TariffChangeStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ChangeTransactionTariffResponse {
/// Creates a `ChangeTransactionTariffResponse` from its required fields.
#[must_use]
pub fn new(status: TariffChangeStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ChangeTransactionTariffResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ChangeTransactionTariffResponse {}
impl Response for ChangeTransactionTariffResponse {}
/// Spec: OCPP 2.1 · C — Authorization · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearCacheRequest {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearCacheRequest {
/// Creates an empty `ClearCacheRequest`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearCacheRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearCacheRequest {}
impl Request for ClearCacheRequest {
type Action = Action;
const ACTION: Action = Action::ClearCache;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ClearCacheResponse;
}
impl Confirmed for ClearCacheRequest {}
/// Spec: OCPP 2.1 · C — Authorization · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClearCacheResponse {
/// The `status` member.
pub status: ClearCacheStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearCacheResponse {
/// Creates a `ClearCacheResponse` from its required fields.
#[must_use]
pub fn new(status: ClearCacheStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearCacheResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearCacheResponse {}
impl Response for ClearCacheResponse {}
/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearChargingProfileRequest {
/// The Id of the charging profile to clear.
#[serde(rename = "chargingProfileId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub charging_profile_id: Option<i32>,
/// The `chargingProfileCriteria` member.
#[serde(rename = "chargingProfileCriteria")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub charging_profile_criteria: Option<ClearChargingProfile>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearChargingProfileRequest {
/// Creates an empty `ClearChargingProfileRequest`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `chargingProfileId` field.
#[must_use]
pub fn with_charging_profile_id(mut self, value: i32) -> Self {
self.charging_profile_id = Some(value);
self
}
/// Sets the optional `chargingProfileCriteria` field.
#[must_use]
pub fn with_charging_profile_criteria(mut self, value: ClearChargingProfile) -> Self {
self.charging_profile_criteria = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearChargingProfileRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("chargingProfileCriteria");
if let Some(value) = &self.charging_profile_criteria {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearChargingProfileRequest {}
impl Request for ClearChargingProfileRequest {
type Action = Action;
const ACTION: Action = Action::ClearChargingProfile;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ClearChargingProfileResponse;
}
impl Confirmed for ClearChargingProfileRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClearChargingProfileResponse {
/// The `status` member.
pub status: ClearChargingProfileStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearChargingProfileResponse {
/// Creates a `ClearChargingProfileResponse` from its required fields.
#[must_use]
pub fn new(status: ClearChargingProfileStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearChargingProfileResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearChargingProfileResponse {}
impl Response for ClearChargingProfileResponse {}
/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClearDERControlRequest {
/// True: clearing default DER controls. False: clearing scheduled controls.
#[serde(rename = "isDefault")]
pub is_default: bool,
/// The `controlType` member.
#[serde(rename = "controlType")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub control_type: Option<DERControl>,
/// Id of control setting to clear. When omitted all settings for _controlType_ are cleared.
#[serde(rename = "controlId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub control_id: Option<String>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearDERControlRequest {
/// Creates a `ClearDERControlRequest` from its required fields.
#[must_use]
pub fn new(is_default: bool) -> Self {
Self {
is_default,
control_type: None,
control_id: None,
custom_data: None,
}
}
/// Sets the optional `controlType` field.
#[must_use]
pub fn with_control_type(mut self, value: DERControl) -> Self {
self.control_type = Some(value);
self
}
/// Sets the optional `controlId` field.
#[must_use]
pub fn with_control_id(mut self, value: impl Into<String>) -> Self {
self.control_id = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearDERControlRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("controlType");
if let Some(value) = &self.control_type {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("controlId");
if let Some(value) = &self.control_id {
validate::string(value.as_str(), None, Some(36), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearDERControlRequest {}
impl Request for ClearDERControlRequest {
type Action = Action;
const ACTION: Action = Action::ClearDERControl;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ClearDERControlResponse;
}
impl Confirmed for ClearDERControlRequest {}
/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClearDERControlResponse {
/// The `status` member.
pub status: DERControlStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearDERControlResponse {
/// Creates a `ClearDERControlResponse` from its required fields.
#[must_use]
pub fn new(status: DERControlStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearDERControlResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearDERControlResponse {}
impl Response for ClearDERControlResponse {}
/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClearDisplayMessageRequest {
/// Id of the message that SHALL be removed from the Charging Station.
#[serde(deserialize_with = "crate::types::integer::one")]
pub id: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearDisplayMessageRequest {
/// Creates a `ClearDisplayMessageRequest` from its required fields.
#[must_use]
pub fn new(id: i32) -> Self {
Self {
id,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearDisplayMessageRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("id");
validate::int_range(i64::from(self.id), Some(0), None, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearDisplayMessageRequest {}
impl Request for ClearDisplayMessageRequest {
type Action = Action;
const ACTION: Action = Action::ClearDisplayMessage;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ClearDisplayMessageResponse;
}
impl Confirmed for ClearDisplayMessageRequest {}
/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClearDisplayMessageResponse {
/// The `status` member.
pub status: ClearMessageStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearDisplayMessageResponse {
/// Creates a `ClearDisplayMessageResponse` from its required fields.
#[must_use]
pub fn new(status: ClearMessageStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearDisplayMessageResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearDisplayMessageResponse {}
impl Response for ClearDisplayMessageResponse {}
/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearTariffsRequest {
/// List of tariff Ids to clear. When absent clears all tariffs at _evseId_.
#[serde(rename = "tariffIds")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tariff_ids: Option<Vec<String>>,
/// When present only clear tariffs matching _tariffIds_ at EVSE _evseId_.
#[serde(rename = "evseId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub evse_id: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearTariffsRequest {
/// Creates an empty `ClearTariffsRequest`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `tariffIds` field.
#[must_use]
pub fn with_tariff_ids(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
self.tariff_ids = Some(value.into_iter().map(Into::into).collect());
self
}
/// Sets the optional `evseId` field.
#[must_use]
pub fn with_evse_id(mut self, value: i32) -> Self {
self.evse_id = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearTariffsRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("tariffIds");
if let Some(value) = &self.tariff_ids {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
validate::string(item.as_str(), None, Some(60), path, out);
path.pop();
}
}
path.pop();
path.push_key("evseId");
if let Some(value) = &self.evse_id {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearTariffsRequest {}
impl Request for ClearTariffsRequest {
type Action = Action;
const ACTION: Action = Action::ClearTariffs;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ClearTariffsResponse;
}
impl Confirmed for ClearTariffsRequest {}
/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClearTariffsResponse {
/// The `clearTariffsResult` member.
#[serde(rename = "clearTariffsResult")]
pub clear_tariffs_result: Vec<ClearTariffsResult>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearTariffsResponse {
/// Creates a `ClearTariffsResponse` from its required fields.
#[must_use]
pub fn new(clear_tariffs_result: Vec<ClearTariffsResult>) -> Self {
Self {
clear_tariffs_result,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearTariffsResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("clearTariffsResult");
validate::list_len(self.clear_tariffs_result.len(), Some(1), None, path, out);
for (index, item) in self.clear_tariffs_result.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearTariffsResponse {}
impl Response for ClearTariffsResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClearVariableMonitoringRequest {
/// List of the monitors to be cleared, identified by there Id.
#[serde(deserialize_with = "crate::types::integer::list")]
pub id: Vec<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearVariableMonitoringRequest {
/// Creates a `ClearVariableMonitoringRequest` from its required fields.
#[must_use]
pub fn new(id: Vec<i32>) -> Self {
Self {
id,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearVariableMonitoringRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("id");
validate::list_len(self.id.len(), Some(1), None, path, out);
for (index, item) in self.id.iter().enumerate() {
path.push_index(index);
validate::int_range(i64::from(*item), Some(0), None, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearVariableMonitoringRequest {}
impl Request for ClearVariableMonitoringRequest {
type Action = Action;
const ACTION: Action = Action::ClearVariableMonitoring;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ClearVariableMonitoringResponse;
}
impl Confirmed for ClearVariableMonitoringRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClearVariableMonitoringResponse {
/// The `clearMonitoringResult` member.
#[serde(rename = "clearMonitoringResult")]
pub clear_monitoring_result: Vec<ClearMonitoringResult>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearVariableMonitoringResponse {
/// Creates a `ClearVariableMonitoringResponse` from its required fields.
#[must_use]
pub fn new(clear_monitoring_result: Vec<ClearMonitoringResult>) -> Self {
Self {
clear_monitoring_result,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearVariableMonitoringResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("clearMonitoringResult");
validate::list_len(self.clear_monitoring_result.len(), Some(1), None, path, out);
for (index, item) in self.clear_monitoring_result.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearVariableMonitoringResponse {}
impl Response for ClearVariableMonitoringResponse {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClearedChargingLimitRequest {
/// Source of the charging limit. Allowed values defined in Appendix as ChargingLimitSourceEnumStringType.
#[serde(rename = "chargingLimitSource")]
pub charging_limit_source: String,
/// EVSE Identifier.
#[serde(rename = "evseId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub evse_id: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearedChargingLimitRequest {
/// Creates a `ClearedChargingLimitRequest` from its required fields.
#[must_use]
pub fn new(charging_limit_source: impl Into<String>) -> Self {
Self {
charging_limit_source: charging_limit_source.into(),
evse_id: None,
custom_data: None,
}
}
/// Sets the optional `evseId` field.
#[must_use]
pub fn with_evse_id(mut self, value: i32) -> Self {
self.evse_id = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearedChargingLimitRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("chargingLimitSource");
validate::string(
self.charging_limit_source.as_str(),
None,
Some(20),
path,
out,
);
path.pop();
path.push_key("evseId");
if let Some(value) = &self.evse_id {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearedChargingLimitRequest {}
impl Request for ClearedChargingLimitRequest {
type Action = Action;
const ACTION: Action = Action::ClearedChargingLimit;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = ClearedChargingLimitResponse;
}
impl Confirmed for ClearedChargingLimitRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearedChargingLimitResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClearedChargingLimitResponse {
/// Creates an empty `ClearedChargingLimitResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClearedChargingLimitResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClearedChargingLimitResponse {}
impl Response for ClearedChargingLimitResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClosePeriodicEventStreamRequest {
/// Id of stream to close.
#[serde(deserialize_with = "crate::types::integer::one")]
pub id: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClosePeriodicEventStreamRequest {
/// Creates a `ClosePeriodicEventStreamRequest` from its required fields.
#[must_use]
pub fn new(id: i32) -> Self {
Self {
id,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClosePeriodicEventStreamRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("id");
validate::int_range(i64::from(self.id), Some(0), None, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClosePeriodicEventStreamRequest {}
impl Request for ClosePeriodicEventStreamRequest {
type Action = Action;
const ACTION: Action = Action::ClosePeriodicEventStream;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = ClosePeriodicEventStreamResponse;
}
impl Confirmed for ClosePeriodicEventStreamRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ClosePeriodicEventStreamResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ClosePeriodicEventStreamResponse {
/// Creates an empty `ClosePeriodicEventStreamResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ClosePeriodicEventStreamResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ClosePeriodicEventStreamResponse {}
impl Response for ClosePeriodicEventStreamResponse {}
/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CostUpdatedRequest {
/// Current total cost, based on the information known by the CSMS, of the transaction including taxes. In the currency configured with the configuration Variable: \[<<configkey-currency, Currency>>\]
#[serde(rename = "totalCost")]
pub total_cost: crate::types::Decimal,
/// Transaction Id of the transaction the current cost are asked for.
#[serde(rename = "transactionId")]
pub transaction_id: String,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl CostUpdatedRequest {
/// Creates a `CostUpdatedRequest` from its required fields.
#[must_use]
pub fn new(
total_cost: impl Into<crate::types::Decimal>,
transaction_id: impl Into<String>,
) -> Self {
Self {
total_cost: total_cost.into(),
transaction_id: transaction_id.into(),
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for CostUpdatedRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("transactionId");
validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for CostUpdatedRequest {}
impl Request for CostUpdatedRequest {
type Action = Action;
const ACTION: Action = Action::CostUpdated;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = CostUpdatedResponse;
}
impl Confirmed for CostUpdatedRequest {}
/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct CostUpdatedResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl CostUpdatedResponse {
/// Creates an empty `CostUpdatedResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for CostUpdatedResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for CostUpdatedResponse {}
impl Response for CostUpdatedResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CustomerInformationRequest {
/// The Id of the request.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// Flag indicating whether the Charging Station should return NotifyCustomerInformationRequest messages containing information about the customer referred to.
pub report: bool,
/// Flag indicating whether the Charging Station should clear all information about the customer referred to.
pub clear: bool,
/// The `customerCertificate` member.
#[serde(rename = "customerCertificate")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub customer_certificate: Option<CertificateHashData>,
/// The `idToken` member.
#[serde(rename = "idToken")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id_token: Option<IdToken>,
/// 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.
#[serde(rename = "customerIdentifier")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub customer_identifier: Option<String>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl CustomerInformationRequest {
/// Creates a `CustomerInformationRequest` from its required fields.
#[must_use]
pub fn new(request_id: i32, report: bool, clear: bool) -> Self {
Self {
request_id,
report,
clear,
customer_certificate: None,
id_token: None,
customer_identifier: None,
custom_data: None,
}
}
/// Sets the optional `customerCertificate` field.
#[must_use]
pub fn with_customer_certificate(mut self, value: CertificateHashData) -> Self {
self.customer_certificate = Some(value);
self
}
/// Sets the optional `idToken` field.
#[must_use]
pub fn with_id_token(mut self, value: IdToken) -> Self {
self.id_token = Some(value);
self
}
/// Sets the optional `customerIdentifier` field.
#[must_use]
pub fn with_customer_identifier(mut self, value: impl Into<String>) -> Self {
self.customer_identifier = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for CustomerInformationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("requestId");
validate::int_range(i64::from(self.request_id), Some(0), None, path, out);
path.pop();
path.push_key("customerCertificate");
if let Some(value) = &self.customer_certificate {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("idToken");
if let Some(value) = &self.id_token {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customerIdentifier");
if let Some(value) = &self.customer_identifier {
validate::string(value.as_str(), None, Some(64), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for CustomerInformationRequest {}
impl Request for CustomerInformationRequest {
type Action = Action;
const ACTION: Action = Action::CustomerInformation;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = CustomerInformationResponse;
}
impl Confirmed for CustomerInformationRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CustomerInformationResponse {
/// The `status` member.
pub status: CustomerInformationStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl CustomerInformationResponse {
/// Creates a `CustomerInformationResponse` from its required fields.
#[must_use]
pub fn new(status: CustomerInformationStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for CustomerInformationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for CustomerInformationResponse {}
impl Response for CustomerInformationResponse {}
/// Spec: OCPP 2.1 · P — Data Transfer · either direction · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DataTransferRequest {
/// This identifies the Vendor specific implementation
#[serde(rename = "vendorId")]
pub vendor_id: String,
/// May be used to indicate a specific message or implementation.
#[serde(rename = "messageId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message_id: Option<String>,
/// Data without specified length or format. This needs to be decided by both parties (Open to implementation).
#[serde(default, skip_serializing_if = "Option::is_none")]
pub data: Option<serde_json::Value>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl DataTransferRequest {
/// Creates a `DataTransferRequest` from its required fields.
#[must_use]
pub fn new(vendor_id: impl Into<String>) -> Self {
Self {
vendor_id: vendor_id.into(),
message_id: None,
data: None,
custom_data: None,
}
}
/// Sets the optional `messageId` field.
#[must_use]
pub fn with_message_id(mut self, value: impl Into<String>) -> Self {
self.message_id = Some(value.into());
self
}
/// Sets the optional `data` field.
#[must_use]
pub fn with_data(mut self, value: serde_json::Value) -> Self {
self.data = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for DataTransferRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("vendorId");
validate::string(self.vendor_id.as_str(), None, Some(255), path, out);
path.pop();
path.push_key("messageId");
if let Some(value) = &self.message_id {
validate::string(value.as_str(), None, Some(50), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for DataTransferRequest {}
impl Request for DataTransferRequest {
type Action = Action;
const ACTION: Action = Action::DataTransfer;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Both;
type Response = DataTransferResponse;
}
impl Confirmed for DataTransferRequest {}
/// Spec: OCPP 2.1 · P — Data Transfer · either direction · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DataTransferResponse {
/// The `status` member.
pub status: DataTransferStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// Data without specified length or format, in response to request.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub data: Option<serde_json::Value>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl DataTransferResponse {
/// Creates a `DataTransferResponse` from its required fields.
#[must_use]
pub fn new(status: DataTransferStatus) -> Self {
Self {
status,
status_info: None,
data: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `data` field.
#[must_use]
pub fn with_data(mut self, value: serde_json::Value) -> Self {
self.data = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for DataTransferResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for DataTransferResponse {}
impl Response for DataTransferResponse {}
/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeleteCertificateRequest {
/// The `certificateHashData` member.
#[serde(rename = "certificateHashData")]
pub certificate_hash_data: CertificateHashData,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl DeleteCertificateRequest {
/// Creates a `DeleteCertificateRequest` from its required fields.
#[must_use]
pub fn new(certificate_hash_data: CertificateHashData) -> Self {
Self {
certificate_hash_data,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for DeleteCertificateRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("certificateHashData");
Validate::validate_at(&self.certificate_hash_data, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for DeleteCertificateRequest {}
impl Request for DeleteCertificateRequest {
type Action = Action;
const ACTION: Action = Action::DeleteCertificate;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = DeleteCertificateResponse;
}
impl Confirmed for DeleteCertificateRequest {}
/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeleteCertificateResponse {
/// The `status` member.
pub status: DeleteCertificateStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl DeleteCertificateResponse {
/// Creates a `DeleteCertificateResponse` from its required fields.
#[must_use]
pub fn new(status: DeleteCertificateStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for DeleteCertificateResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for DeleteCertificateResponse {}
impl Response for DeleteCertificateResponse {}
/// Spec: OCPP 2.1 · L — Firmware Management · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct FirmwareStatusNotificationRequest {
/// The `status` member.
pub status: FirmwareStatus,
/// 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.
#[serde(rename = "requestId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub request_id: Option<i32>,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl FirmwareStatusNotificationRequest {
/// Creates a `FirmwareStatusNotificationRequest` from its required fields.
#[must_use]
pub fn new(status: FirmwareStatus) -> Self {
Self {
status,
request_id: None,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `requestId` field.
#[must_use]
pub fn with_request_id(mut self, value: i32) -> Self {
self.request_id = Some(value);
self
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for FirmwareStatusNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for FirmwareStatusNotificationRequest {}
impl Request for FirmwareStatusNotificationRequest {
type Action = Action;
const ACTION: Action = Action::FirmwareStatusNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = FirmwareStatusNotificationResponse;
}
impl Confirmed for FirmwareStatusNotificationRequest {}
/// Spec: OCPP 2.1 · L — Firmware Management · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct FirmwareStatusNotificationResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl FirmwareStatusNotificationResponse {
/// Creates an empty `FirmwareStatusNotificationResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for FirmwareStatusNotificationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for FirmwareStatusNotificationResponse {}
impl Response for FirmwareStatusNotificationResponse {}
/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Get15118EVCertificateRequest {
/// Schema version currently used for the 15118 session between EV and Charging Station. Needed for parsing of the EXI stream by the CSMS.
#[serde(rename = "iso15118SchemaVersion")]
pub iso15118_schema_version: String,
/// The `action` member.
pub action: CertificateAction,
/// *(2.1)* Raw CertificateInstallationReq request from EV, Base64 encoded. +
/// Extended to support ISO 15118-20 certificates. The minimum supported length is 11000. If a longer _exiRequest_ is supported, then the supported length must be communicated in variable OCPPCommCtrlr.FieldLength\[ "Get15118EVCertificateRequest.exiRequest" \].
#[serde(rename = "exiRequest")]
pub exi_request: String,
/// *(2.1)* Absent during ISO 15118-2 session. Required during ISO 15118-20 session. +
/// Maximum number of contracts that EV wants to install.
#[serde(rename = "maximumContractCertificateChains")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub maximum_contract_certificate_chains: Option<i32>,
/// *(2.1)* Absent during ISO 15118-2 session. Optional during ISO 15118-20 session. List of EMAIDs for which contract certificates must be requested first, in case there are more certificates than allowed by _maximumContractCertificateChains_.
#[serde(rename = "prioritizedEMAIDs")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub prioritized_emai_ds: Option<Vec<String>>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl Get15118EVCertificateRequest {
/// Creates a `Get15118EVCertificateRequest` from its required fields.
#[must_use]
pub fn new(
iso15118_schema_version: impl Into<String>,
action: CertificateAction,
exi_request: impl Into<String>,
) -> Self {
Self {
iso15118_schema_version: iso15118_schema_version.into(),
action,
exi_request: exi_request.into(),
maximum_contract_certificate_chains: None,
prioritized_emai_ds: None,
custom_data: None,
}
}
/// Sets the optional `maximumContractCertificateChains` field.
#[must_use]
pub fn with_maximum_contract_certificate_chains(mut self, value: i32) -> Self {
self.maximum_contract_certificate_chains = Some(value);
self
}
/// Sets the optional `prioritizedEMAIDs` field.
#[must_use]
pub fn with_prioritized_emai_ds(
mut self,
value: impl IntoIterator<Item = impl Into<String>>,
) -> Self {
self.prioritized_emai_ds = Some(value.into_iter().map(Into::into).collect());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for Get15118EVCertificateRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("iso15118SchemaVersion");
validate::string(
self.iso15118_schema_version.as_str(),
None,
Some(50),
path,
out,
);
path.pop();
path.push_key("action");
Validate::validate_at(&self.action, path, out);
path.pop();
path.push_key("exiRequest");
validate::string(self.exi_request.as_str(), None, Some(11000), path, out);
path.pop();
path.push_key("maximumContractCertificateChains");
if let Some(value) = &self.maximum_contract_certificate_chains {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("prioritizedEMAIDs");
if let Some(value) = &self.prioritized_emai_ds {
validate::list_len(value.len(), Some(1), Some(8), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
validate::string(item.as_str(), None, Some(255), path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for Get15118EVCertificateRequest {}
impl Request for Get15118EVCertificateRequest {
type Action = Action;
const ACTION: Action = Action::Get15118EVCertificate;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = Get15118EVCertificateResponse;
}
impl Confirmed for Get15118EVCertificateRequest {}
/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Get15118EVCertificateResponse {
/// The `status` member.
pub status: Iso15118EVCertificateStatus,
/// *(2/1)* Raw CertificateInstallationRes response for the EV, Base64 encoded. +
/// Extended to support ISO 15118-20 certificates. The minimum supported length is 17000. If a longer _exiResponse_ is supported, then the supported length must be communicated in variable OCPPCommCtrlr.FieldLength\[ "Get15118EVCertificateResponse.exiResponse" \].
#[serde(rename = "exiResponse")]
pub exi_response: String,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// *(2.1)* Number of contracts that can be retrieved with additional requests.
#[serde(rename = "remainingContracts")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub remaining_contracts: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl Get15118EVCertificateResponse {
/// Creates a `Get15118EVCertificateResponse` from its required fields.
#[must_use]
pub fn new(status: Iso15118EVCertificateStatus, exi_response: impl Into<String>) -> Self {
Self {
status,
exi_response: exi_response.into(),
status_info: None,
remaining_contracts: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `remainingContracts` field.
#[must_use]
pub fn with_remaining_contracts(mut self, value: i32) -> Self {
self.remaining_contracts = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for Get15118EVCertificateResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("exiResponse");
validate::string(self.exi_response.as_str(), None, Some(17000), path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("remainingContracts");
if let Some(value) = &self.remaining_contracts {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for Get15118EVCertificateResponse {}
impl Response for Get15118EVCertificateResponse {}
/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetBaseReportRequest {
/// The Id of the request.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// The `reportBase` member.
#[serde(rename = "reportBase")]
pub report_base: ReportBase,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetBaseReportRequest {
/// Creates a `GetBaseReportRequest` from its required fields.
#[must_use]
pub fn new(request_id: i32, report_base: ReportBase) -> Self {
Self {
request_id,
report_base,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetBaseReportRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("reportBase");
Validate::validate_at(&self.report_base, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetBaseReportRequest {}
impl Request for GetBaseReportRequest {
type Action = Action;
const ACTION: Action = Action::GetBaseReport;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetBaseReportResponse;
}
impl Confirmed for GetBaseReportRequest {}
/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetBaseReportResponse {
/// The `status` member.
pub status: GenericDeviceModelStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetBaseReportResponse {
/// Creates a `GetBaseReportResponse` from its required fields.
#[must_use]
pub fn new(status: GenericDeviceModelStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetBaseReportResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetBaseReportResponse {}
impl Response for GetBaseReportResponse {}
/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetCertificateChainStatusRequest {
/// The `certificateStatusRequests` member.
#[serde(rename = "certificateStatusRequests")]
pub certificate_status_requests: Vec<CertificateStatusRequestInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetCertificateChainStatusRequest {
/// Creates a `GetCertificateChainStatusRequest` from its required fields.
#[must_use]
pub fn new(certificate_status_requests: Vec<CertificateStatusRequestInfo>) -> Self {
Self {
certificate_status_requests,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetCertificateChainStatusRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("certificateStatusRequests");
validate::list_len(
self.certificate_status_requests.len(),
Some(1),
Some(4),
path,
out,
);
for (index, item) in self.certificate_status_requests.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetCertificateChainStatusRequest {}
impl Request for GetCertificateChainStatusRequest {
type Action = Action;
const ACTION: Action = Action::GetCertificateChainStatus;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = GetCertificateChainStatusResponse;
}
impl Confirmed for GetCertificateChainStatusRequest {}
/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetCertificateChainStatusResponse {
/// The `certificateStatus` member.
#[serde(rename = "certificateStatus")]
pub certificate_status: Vec<CertificateStatus>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetCertificateChainStatusResponse {
/// Creates a `GetCertificateChainStatusResponse` from its required fields.
#[must_use]
pub fn new(certificate_status: Vec<CertificateStatus>) -> Self {
Self {
certificate_status,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetCertificateChainStatusResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("certificateStatus");
validate::list_len(self.certificate_status.len(), Some(1), Some(4), path, out);
for (index, item) in self.certificate_status.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetCertificateChainStatusResponse {}
impl Response for GetCertificateChainStatusResponse {}
/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetCertificateStatusRequest {
/// The `ocspRequestData` member.
#[serde(rename = "ocspRequestData")]
pub ocsp_request_data: OCSPRequestData,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetCertificateStatusRequest {
/// Creates a `GetCertificateStatusRequest` from its required fields.
#[must_use]
pub fn new(ocsp_request_data: OCSPRequestData) -> Self {
Self {
ocsp_request_data,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetCertificateStatusRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("ocspRequestData");
Validate::validate_at(&self.ocsp_request_data, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetCertificateStatusRequest {}
impl Request for GetCertificateStatusRequest {
type Action = Action;
const ACTION: Action = Action::GetCertificateStatus;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = GetCertificateStatusResponse;
}
impl Confirmed for GetCertificateStatusRequest {}
/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetCertificateStatusResponse {
/// The `status` member.
pub status: GetCertificateStatusEnum,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// *(2.1)* OCSPResponse class as defined in <<ref-ocpp_security_24, IETF RFC 6960>>. DER encoded (as defined in <<ref-ocpp_security_24, IETF RFC 6960>>), and then base64 encoded. MAY only be omitted when status is not Accepted. +
/// The minimum supported length is 18000. If a longer _ocspResult_ is supported, then the supported length must be communicated in variable OCPPCommCtrlr.FieldLength\[ "GetCertificateStatusResponse.ocspResult" \].
#[serde(rename = "ocspResult")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ocsp_result: Option<String>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetCertificateStatusResponse {
/// Creates a `GetCertificateStatusResponse` from its required fields.
#[must_use]
pub fn new(status: GetCertificateStatusEnum) -> Self {
Self {
status,
status_info: None,
ocsp_result: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `ocspResult` field.
#[must_use]
pub fn with_ocsp_result(mut self, value: impl Into<String>) -> Self {
self.ocsp_result = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetCertificateStatusResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("ocspResult");
if let Some(value) = &self.ocsp_result {
validate::string(value.as_str(), None, Some(18000), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetCertificateStatusResponse {}
impl Response for GetCertificateStatusResponse {}
/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetChargingProfilesRequest {
/// Reference identification that is to be used by the Charging Station in the <<reportchargingprofilesrequest, ReportChargingProfilesRequest>> when provided.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// The `chargingProfile` member.
#[serde(rename = "chargingProfile")]
pub charging_profile: ChargingProfileCriterion,
/// 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. +
/// Reported charging profiles SHALL match the criteria in field _chargingProfile_.
#[serde(rename = "evseId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub evse_id: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetChargingProfilesRequest {
/// Creates a `GetChargingProfilesRequest` from its required fields.
#[must_use]
pub fn new(request_id: i32, charging_profile: ChargingProfileCriterion) -> Self {
Self {
request_id,
charging_profile,
evse_id: None,
custom_data: None,
}
}
/// Sets the optional `evseId` field.
#[must_use]
pub fn with_evse_id(mut self, value: i32) -> Self {
self.evse_id = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetChargingProfilesRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("chargingProfile");
Validate::validate_at(&self.charging_profile, path, out);
path.pop();
path.push_key("evseId");
if let Some(value) = &self.evse_id {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetChargingProfilesRequest {}
impl Request for GetChargingProfilesRequest {
type Action = Action;
const ACTION: Action = Action::GetChargingProfiles;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetChargingProfilesResponse;
}
impl Confirmed for GetChargingProfilesRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetChargingProfilesResponse {
/// The `status` member.
pub status: GetChargingProfileStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetChargingProfilesResponse {
/// Creates a `GetChargingProfilesResponse` from its required fields.
#[must_use]
pub fn new(status: GetChargingProfileStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetChargingProfilesResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetChargingProfilesResponse {}
impl Response for GetChargingProfilesResponse {}
/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetCompositeScheduleRequest {
/// Length of the requested schedule in seconds.
#[serde(deserialize_with = "crate::types::integer::one")]
pub duration: i32,
/// 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.
#[serde(rename = "evseId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub evse_id: i32,
/// The `chargingRateUnit` member.
#[serde(rename = "chargingRateUnit")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub charging_rate_unit: Option<ChargingRateUnit>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetCompositeScheduleRequest {
/// Creates a `GetCompositeScheduleRequest` from its required fields.
#[must_use]
pub fn new(duration: i32, evse_id: i32) -> Self {
Self {
duration,
evse_id,
charging_rate_unit: None,
custom_data: None,
}
}
/// Sets the optional `chargingRateUnit` field.
#[must_use]
pub fn with_charging_rate_unit(mut self, value: ChargingRateUnit) -> Self {
self.charging_rate_unit = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetCompositeScheduleRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("evseId");
validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
path.pop();
path.push_key("chargingRateUnit");
if let Some(value) = &self.charging_rate_unit {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetCompositeScheduleRequest {}
impl Request for GetCompositeScheduleRequest {
type Action = Action;
const ACTION: Action = Action::GetCompositeSchedule;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetCompositeScheduleResponse;
}
impl Confirmed for GetCompositeScheduleRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetCompositeScheduleResponse {
/// The `status` member.
pub status: GenericStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `schedule` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub schedule: Option<CompositeSchedule>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetCompositeScheduleResponse {
/// Creates a `GetCompositeScheduleResponse` from its required fields.
#[must_use]
pub fn new(status: GenericStatus) -> Self {
Self {
status,
status_info: None,
schedule: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `schedule` field.
#[must_use]
pub fn with_schedule(mut self, value: CompositeSchedule) -> Self {
self.schedule = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetCompositeScheduleResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("schedule");
if let Some(value) = &self.schedule {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetCompositeScheduleResponse {}
impl Response for GetCompositeScheduleResponse {}
/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetDERControlRequest {
/// RequestId to be used in ReportDERControlRequest.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// True: get a default DER control. False: get a scheduled control.
#[serde(rename = "isDefault")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_default: Option<bool>,
/// The `controlType` member.
#[serde(rename = "controlType")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub control_type: Option<DERControl>,
/// Id of setting to get. When omitted all settings for _controlType_ are retrieved.
#[serde(rename = "controlId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub control_id: Option<String>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetDERControlRequest {
/// Creates a `GetDERControlRequest` from its required fields.
#[must_use]
pub fn new(request_id: i32) -> Self {
Self {
request_id,
is_default: None,
control_type: None,
control_id: None,
custom_data: None,
}
}
/// Sets the optional `isDefault` field.
#[must_use]
pub fn with_is_default(mut self, value: bool) -> Self {
self.is_default = Some(value);
self
}
/// Sets the optional `controlType` field.
#[must_use]
pub fn with_control_type(mut self, value: DERControl) -> Self {
self.control_type = Some(value);
self
}
/// Sets the optional `controlId` field.
#[must_use]
pub fn with_control_id(mut self, value: impl Into<String>) -> Self {
self.control_id = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetDERControlRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("controlType");
if let Some(value) = &self.control_type {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("controlId");
if let Some(value) = &self.control_id {
validate::string(value.as_str(), None, Some(36), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetDERControlRequest {}
impl Request for GetDERControlRequest {
type Action = Action;
const ACTION: Action = Action::GetDERControl;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetDERControlResponse;
}
impl Confirmed for GetDERControlRequest {}
/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetDERControlResponse {
/// The `status` member.
pub status: DERControlStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetDERControlResponse {
/// Creates a `GetDERControlResponse` from its required fields.
#[must_use]
pub fn new(status: DERControlStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetDERControlResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetDERControlResponse {}
impl Response for GetDERControlResponse {}
/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetDisplayMessagesRequest {
/// The Id of this request.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// If provided the Charging Station shall return Display Messages of the given ids. This field SHALL NOT contain more ids than set in <<configkey-number-of-display-messages,NumberOfDisplayMessages.maxLimit>>
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option_list")]
pub id: Option<Vec<i32>>,
/// The `priority` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub priority: Option<MessagePriority>,
/// The `state` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub state: Option<MessageState>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetDisplayMessagesRequest {
/// Creates a `GetDisplayMessagesRequest` from its required fields.
#[must_use]
pub fn new(request_id: i32) -> Self {
Self {
request_id,
id: None,
priority: None,
state: None,
custom_data: None,
}
}
/// Sets the optional `id` field.
#[must_use]
pub fn with_id(mut self, value: Vec<i32>) -> Self {
self.id = Some(value);
self
}
/// Sets the optional `priority` field.
#[must_use]
pub fn with_priority(mut self, value: MessagePriority) -> Self {
self.priority = Some(value);
self
}
/// Sets the optional `state` field.
#[must_use]
pub fn with_state(mut self, value: MessageState) -> Self {
self.state = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetDisplayMessagesRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("id");
if let Some(value) = &self.id {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
validate::int_range(i64::from(*item), Some(0), None, path, out);
path.pop();
}
}
path.pop();
path.push_key("priority");
if let Some(value) = &self.priority {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("state");
if let Some(value) = &self.state {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetDisplayMessagesRequest {}
impl Request for GetDisplayMessagesRequest {
type Action = Action;
const ACTION: Action = Action::GetDisplayMessages;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetDisplayMessagesResponse;
}
impl Confirmed for GetDisplayMessagesRequest {}
/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetDisplayMessagesResponse {
/// The `status` member.
pub status: GetDisplayMessagesStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetDisplayMessagesResponse {
/// Creates a `GetDisplayMessagesResponse` from its required fields.
#[must_use]
pub fn new(status: GetDisplayMessagesStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetDisplayMessagesResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetDisplayMessagesResponse {}
impl Response for GetDisplayMessagesResponse {}
/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct GetInstalledCertificateIdsRequest {
/// Indicates the type of certificates requested. When omitted, all certificate types are requested.
#[serde(rename = "certificateType")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub certificate_type: Option<Vec<GetCertificateIdUse>>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetInstalledCertificateIdsRequest {
/// Creates an empty `GetInstalledCertificateIdsRequest`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `certificateType` field.
#[must_use]
pub fn with_certificate_type(mut self, value: Vec<GetCertificateIdUse>) -> Self {
self.certificate_type = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetInstalledCertificateIdsRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("certificateType");
if let Some(value) = &self.certificate_type {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetInstalledCertificateIdsRequest {}
impl Request for GetInstalledCertificateIdsRequest {
type Action = Action;
const ACTION: Action = Action::GetInstalledCertificateIds;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetInstalledCertificateIdsResponse;
}
impl Confirmed for GetInstalledCertificateIdsRequest {}
/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetInstalledCertificateIdsResponse {
/// The `status` member.
pub status: GetInstalledCertificateStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `certificateHashDataChain` member.
#[serde(rename = "certificateHashDataChain")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub certificate_hash_data_chain: Option<Vec<CertificateHashDataChain>>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetInstalledCertificateIdsResponse {
/// Creates a `GetInstalledCertificateIdsResponse` from its required fields.
#[must_use]
pub fn new(status: GetInstalledCertificateStatus) -> Self {
Self {
status,
status_info: None,
certificate_hash_data_chain: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `certificateHashDataChain` field.
#[must_use]
pub fn with_certificate_hash_data_chain(
mut self,
value: Vec<CertificateHashDataChain>,
) -> Self {
self.certificate_hash_data_chain = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetInstalledCertificateIdsResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("certificateHashDataChain");
if let Some(value) = &self.certificate_hash_data_chain {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetInstalledCertificateIdsResponse {}
impl Response for GetInstalledCertificateIdsResponse {}
/// Spec: OCPP 2.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct GetLocalListVersionRequest {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetLocalListVersionRequest {
/// Creates an empty `GetLocalListVersionRequest`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetLocalListVersionRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetLocalListVersionRequest {}
impl Request for GetLocalListVersionRequest {
type Action = Action;
const ACTION: Action = Action::GetLocalListVersion;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetLocalListVersionResponse;
}
impl Confirmed for GetLocalListVersionRequest {}
/// Spec: OCPP 2.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetLocalListVersionResponse {
/// This contains the current version number of the local authorization list in the Charging Station.
#[serde(rename = "versionNumber")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub version_number: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetLocalListVersionResponse {
/// Creates a `GetLocalListVersionResponse` from its required fields.
#[must_use]
pub fn new(version_number: i32) -> Self {
Self {
version_number,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetLocalListVersionResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetLocalListVersionResponse {}
impl Response for GetLocalListVersionResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetLogRequest {
/// The `log` member.
pub log: LogParameters,
/// The `logType` member.
#[serde(rename = "logType")]
pub log_type: Log,
/// The Id of this request
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// This specifies how many times the Charging Station must retry 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. If the value is 0, it means: no retries.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub retries: Option<i32>,
/// 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.
#[serde(rename = "retryInterval")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub retry_interval: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetLogRequest {
/// Creates a `GetLogRequest` from its required fields.
#[must_use]
pub fn new(log: LogParameters, log_type: Log, request_id: i32) -> Self {
Self {
log,
log_type,
request_id,
retries: None,
retry_interval: None,
custom_data: None,
}
}
/// Sets the optional `retries` field.
#[must_use]
pub fn with_retries(mut self, value: i32) -> Self {
self.retries = Some(value);
self
}
/// Sets the optional `retryInterval` field.
#[must_use]
pub fn with_retry_interval(mut self, value: i32) -> Self {
self.retry_interval = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetLogRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("log");
Validate::validate_at(&self.log, path, out);
path.pop();
path.push_key("logType");
Validate::validate_at(&self.log_type, path, out);
path.pop();
path.push_key("retries");
if let Some(value) = &self.retries {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetLogRequest {}
impl Request for GetLogRequest {
type Action = Action;
const ACTION: Action = Action::GetLog;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetLogResponse;
}
impl Confirmed for GetLogRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetLogResponse {
/// The `status` member.
pub status: LogStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// This contains the name of the log file that will be uploaded. This field is not present when no logging information is available.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub filename: Option<String>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetLogResponse {
/// Creates a `GetLogResponse` from its required fields.
#[must_use]
pub fn new(status: LogStatus) -> Self {
Self {
status,
status_info: None,
filename: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `filename` field.
#[must_use]
pub fn with_filename(mut self, value: impl Into<String>) -> Self {
self.filename = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetLogResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("filename");
if let Some(value) = &self.filename {
validate::string(value.as_str(), None, Some(255), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetLogResponse {}
impl Response for GetLogResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetMonitoringReportRequest {
/// The Id of the request.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// The `componentVariable` member.
#[serde(rename = "componentVariable")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub component_variable: Option<Vec<ComponentVariable>>,
/// This field contains criteria for components for which a monitoring report is requested
#[serde(rename = "monitoringCriteria")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub monitoring_criteria: Option<Vec<MonitoringCriterion>>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetMonitoringReportRequest {
/// Creates a `GetMonitoringReportRequest` from its required fields.
#[must_use]
pub fn new(request_id: i32) -> Self {
Self {
request_id,
component_variable: None,
monitoring_criteria: None,
custom_data: None,
}
}
/// Sets the optional `componentVariable` field.
#[must_use]
pub fn with_component_variable(mut self, value: Vec<ComponentVariable>) -> Self {
self.component_variable = Some(value);
self
}
/// Sets the optional `monitoringCriteria` field.
#[must_use]
pub fn with_monitoring_criteria(mut self, value: Vec<MonitoringCriterion>) -> Self {
self.monitoring_criteria = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetMonitoringReportRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("componentVariable");
if let Some(value) = &self.component_variable {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("monitoringCriteria");
if let Some(value) = &self.monitoring_criteria {
validate::list_len(value.len(), Some(1), Some(3), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetMonitoringReportRequest {}
impl Request for GetMonitoringReportRequest {
type Action = Action;
const ACTION: Action = Action::GetMonitoringReport;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetMonitoringReportResponse;
}
impl Confirmed for GetMonitoringReportRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetMonitoringReportResponse {
/// The `status` member.
pub status: GenericDeviceModelStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetMonitoringReportResponse {
/// Creates a `GetMonitoringReportResponse` from its required fields.
#[must_use]
pub fn new(status: GenericDeviceModelStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetMonitoringReportResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetMonitoringReportResponse {}
impl Response for GetMonitoringReportResponse {}
/// This message is empty. It has no fields.
///
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct GetPeriodicEventStreamRequest {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetPeriodicEventStreamRequest {
/// Creates an empty `GetPeriodicEventStreamRequest`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetPeriodicEventStreamRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetPeriodicEventStreamRequest {}
impl Request for GetPeriodicEventStreamRequest {
type Action = Action;
const ACTION: Action = Action::GetPeriodicEventStream;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetPeriodicEventStreamResponse;
}
impl Confirmed for GetPeriodicEventStreamRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct GetPeriodicEventStreamResponse {
/// The `constantStreamData` member.
#[serde(rename = "constantStreamData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub constant_stream_data: Option<Vec<ConstantStreamData>>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetPeriodicEventStreamResponse {
/// Creates an empty `GetPeriodicEventStreamResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `constantStreamData` field.
#[must_use]
pub fn with_constant_stream_data(mut self, value: Vec<ConstantStreamData>) -> Self {
self.constant_stream_data = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetPeriodicEventStreamResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("constantStreamData");
if let Some(value) = &self.constant_stream_data {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetPeriodicEventStreamResponse {}
impl Response for GetPeriodicEventStreamResponse {}
/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetReportRequest {
/// The Id of the request.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// The `componentVariable` member.
#[serde(rename = "componentVariable")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub component_variable: Option<Vec<ComponentVariable>>,
/// This field contains criteria for components for which a report is requested
#[serde(rename = "componentCriteria")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub component_criteria: Option<Vec<ComponentCriterion>>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetReportRequest {
/// Creates a `GetReportRequest` from its required fields.
#[must_use]
pub fn new(request_id: i32) -> Self {
Self {
request_id,
component_variable: None,
component_criteria: None,
custom_data: None,
}
}
/// Sets the optional `componentVariable` field.
#[must_use]
pub fn with_component_variable(mut self, value: Vec<ComponentVariable>) -> Self {
self.component_variable = Some(value);
self
}
/// Sets the optional `componentCriteria` field.
#[must_use]
pub fn with_component_criteria(mut self, value: Vec<ComponentCriterion>) -> Self {
self.component_criteria = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetReportRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("componentVariable");
if let Some(value) = &self.component_variable {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("componentCriteria");
if let Some(value) = &self.component_criteria {
validate::list_len(value.len(), Some(1), Some(4), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetReportRequest {}
impl Request for GetReportRequest {
type Action = Action;
const ACTION: Action = Action::GetReport;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetReportResponse;
}
impl Confirmed for GetReportRequest {}
/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetReportResponse {
/// The `status` member.
pub status: GenericDeviceModelStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetReportResponse {
/// Creates a `GetReportResponse` from its required fields.
#[must_use]
pub fn new(status: GenericDeviceModelStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetReportResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetReportResponse {}
impl Response for GetReportResponse {}
/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetTariffsRequest {
/// EVSE id to get tariff from. When _evseId_ = 0, this gets tariffs from all EVSEs.
#[serde(rename = "evseId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub evse_id: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetTariffsRequest {
/// Creates a `GetTariffsRequest` from its required fields.
#[must_use]
pub fn new(evse_id: i32) -> Self {
Self {
evse_id,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetTariffsRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("evseId");
validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetTariffsRequest {}
impl Request for GetTariffsRequest {
type Action = Action;
const ACTION: Action = Action::GetTariffs;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetTariffsResponse;
}
impl Confirmed for GetTariffsRequest {}
/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetTariffsResponse {
/// The `status` member.
pub status: TariffGetStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `tariffAssignments` member.
#[serde(rename = "tariffAssignments")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tariff_assignments: Option<Vec<TariffAssignment>>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetTariffsResponse {
/// Creates a `GetTariffsResponse` from its required fields.
#[must_use]
pub fn new(status: TariffGetStatus) -> Self {
Self {
status,
status_info: None,
tariff_assignments: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `tariffAssignments` field.
#[must_use]
pub fn with_tariff_assignments(mut self, value: Vec<TariffAssignment>) -> Self {
self.tariff_assignments = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetTariffsResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("tariffAssignments");
if let Some(value) = &self.tariff_assignments {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetTariffsResponse {}
impl Response for GetTariffsResponse {}
/// Spec: OCPP 2.1 · E — Transactions · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct GetTransactionStatusRequest {
/// The Id of the transaction for which the status is requested.
#[serde(rename = "transactionId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub transaction_id: Option<String>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetTransactionStatusRequest {
/// Creates an empty `GetTransactionStatusRequest`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `transactionId` field.
#[must_use]
pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
self.transaction_id = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetTransactionStatusRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("transactionId");
if let Some(value) = &self.transaction_id {
validate::string(value.as_str(), None, Some(36), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetTransactionStatusRequest {}
impl Request for GetTransactionStatusRequest {
type Action = Action;
const ACTION: Action = Action::GetTransactionStatus;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetTransactionStatusResponse;
}
impl Confirmed for GetTransactionStatusRequest {}
/// Spec: OCPP 2.1 · E — Transactions · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetTransactionStatusResponse {
/// Whether there are still message to be delivered.
#[serde(rename = "messagesInQueue")]
pub messages_in_queue: bool,
/// Whether the transaction is still ongoing.
#[serde(rename = "ongoingIndicator")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ongoing_indicator: Option<bool>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetTransactionStatusResponse {
/// Creates a `GetTransactionStatusResponse` from its required fields.
#[must_use]
pub fn new(messages_in_queue: bool) -> Self {
Self {
messages_in_queue,
ongoing_indicator: None,
custom_data: None,
}
}
/// Sets the optional `ongoingIndicator` field.
#[must_use]
pub fn with_ongoing_indicator(mut self, value: bool) -> Self {
self.ongoing_indicator = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetTransactionStatusResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetTransactionStatusResponse {}
impl Response for GetTransactionStatusResponse {}
/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetVariablesRequest {
/// The `getVariableData` member.
#[serde(rename = "getVariableData")]
pub get_variable_data: Vec<GetVariableData>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetVariablesRequest {
/// Creates a `GetVariablesRequest` from its required fields.
#[must_use]
pub fn new(get_variable_data: Vec<GetVariableData>) -> Self {
Self {
get_variable_data,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetVariablesRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("getVariableData");
validate::list_len(self.get_variable_data.len(), Some(1), None, path, out);
for (index, item) in self.get_variable_data.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetVariablesRequest {}
impl Request for GetVariablesRequest {
type Action = Action;
const ACTION: Action = Action::GetVariables;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = GetVariablesResponse;
}
impl Confirmed for GetVariablesRequest {}
/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetVariablesResponse {
/// The `getVariableResult` member.
#[serde(rename = "getVariableResult")]
pub get_variable_result: Vec<GetVariableResult>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl GetVariablesResponse {
/// Creates a `GetVariablesResponse` from its required fields.
#[must_use]
pub fn new(get_variable_result: Vec<GetVariableResult>) -> Self {
Self {
get_variable_result,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for GetVariablesResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("getVariableResult");
validate::list_len(self.get_variable_result.len(), Some(1), None, path, out);
for (index, item) in self.get_variable_result.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for GetVariablesResponse {}
impl Response for GetVariablesResponse {}
/// Spec: OCPP 2.1 · G — Availability · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct HeartbeatRequest {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl HeartbeatRequest {
/// Creates an empty `HeartbeatRequest`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for HeartbeatRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for HeartbeatRequest {}
impl Request for HeartbeatRequest {
type Action = Action;
const ACTION: Action = Action::Heartbeat;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = HeartbeatResponse;
}
impl Confirmed for HeartbeatRequest {}
/// Spec: OCPP 2.1 · G — Availability · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct HeartbeatResponse {
/// Contains the current time of the CSMS.
#[serde(rename = "currentTime")]
pub current_time: crate::types::DateTime,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl HeartbeatResponse {
/// Creates a `HeartbeatResponse` from its required fields.
#[must_use]
pub fn new(current_time: impl Into<crate::types::DateTime>) -> Self {
Self {
current_time: current_time.into(),
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for HeartbeatResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for HeartbeatResponse {}
impl Response for HeartbeatResponse {}
/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct InstallCertificateRequest {
/// The `certificateType` member.
#[serde(rename = "certificateType")]
pub certificate_type: InstallCertificateUse,
/// A PEM encoded X.509 certificate.
pub certificate: String,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl InstallCertificateRequest {
/// Creates a `InstallCertificateRequest` from its required fields.
#[must_use]
pub fn new(certificate_type: InstallCertificateUse, certificate: impl Into<String>) -> Self {
Self {
certificate_type,
certificate: certificate.into(),
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for InstallCertificateRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("certificateType");
Validate::validate_at(&self.certificate_type, path, out);
path.pop();
path.push_key("certificate");
validate::string(self.certificate.as_str(), None, Some(10000), path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for InstallCertificateRequest {}
impl Request for InstallCertificateRequest {
type Action = Action;
const ACTION: Action = Action::InstallCertificate;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = InstallCertificateResponse;
}
impl Confirmed for InstallCertificateRequest {}
/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct InstallCertificateResponse {
/// The `status` member.
pub status: InstallCertificateStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl InstallCertificateResponse {
/// Creates a `InstallCertificateResponse` from its required fields.
#[must_use]
pub fn new(status: InstallCertificateStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for InstallCertificateResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for InstallCertificateResponse {}
impl Response for InstallCertificateResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct LogStatusNotificationRequest {
/// The `status` member.
pub status: UploadLogStatus,
/// 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.
#[serde(rename = "requestId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub request_id: Option<i32>,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl LogStatusNotificationRequest {
/// Creates a `LogStatusNotificationRequest` from its required fields.
#[must_use]
pub fn new(status: UploadLogStatus) -> Self {
Self {
status,
request_id: None,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `requestId` field.
#[must_use]
pub fn with_request_id(mut self, value: i32) -> Self {
self.request_id = Some(value);
self
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for LogStatusNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for LogStatusNotificationRequest {}
impl Request for LogStatusNotificationRequest {
type Action = Action;
const ACTION: Action = Action::LogStatusNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = LogStatusNotificationResponse;
}
impl Confirmed for LogStatusNotificationRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct LogStatusNotificationResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl LogStatusNotificationResponse {
/// Creates an empty `LogStatusNotificationResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for LogStatusNotificationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for LogStatusNotificationResponse {}
impl Response for LogStatusNotificationResponse {}
/// Spec: OCPP 2.1 · J — Meter Values · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MeterValuesRequest {
/// This contains a number (>0) designating an EVSE of the Charging Station. ‘0’ (zero) is used to designate the main power meter.
#[serde(rename = "evseId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub evse_id: i32,
/// The `meterValue` member.
#[serde(rename = "meterValue")]
pub meter_value: Vec<MeterValue>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl MeterValuesRequest {
/// Creates a `MeterValuesRequest` from its required fields.
#[must_use]
pub fn new(evse_id: i32, meter_value: Vec<MeterValue>) -> Self {
Self {
evse_id,
meter_value,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for MeterValuesRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("evseId");
validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
path.pop();
path.push_key("meterValue");
validate::list_len(self.meter_value.len(), Some(1), None, path, out);
for (index, item) in self.meter_value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for MeterValuesRequest {}
impl Request for MeterValuesRequest {
type Action = Action;
const ACTION: Action = Action::MeterValues;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = MeterValuesResponse;
}
impl Confirmed for MeterValuesRequest {}
/// Spec: OCPP 2.1 · J — Meter Values · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct MeterValuesResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl MeterValuesResponse {
/// Creates an empty `MeterValuesResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for MeterValuesResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for MeterValuesResponse {}
impl Response for MeterValuesResponse {}
/// Spec: OCPP 2.1 · Q — Bidirectional Power Transfer · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyAllowedEnergyTransferRequest {
/// The transaction for which the allowed energy transfer is allowed.
#[serde(rename = "transactionId")]
pub transaction_id: String,
/// Modes of energy transfer that are accepted by CSMS.
#[serde(rename = "allowedEnergyTransfer")]
pub allowed_energy_transfer: Vec<EnergyTransferMode>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyAllowedEnergyTransferRequest {
/// Creates a `NotifyAllowedEnergyTransferRequest` from its required fields.
#[must_use]
pub fn new(
transaction_id: impl Into<String>,
allowed_energy_transfer: Vec<EnergyTransferMode>,
) -> Self {
Self {
transaction_id: transaction_id.into(),
allowed_energy_transfer,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyAllowedEnergyTransferRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("transactionId");
validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
path.pop();
path.push_key("allowedEnergyTransfer");
validate::list_len(self.allowed_energy_transfer.len(), Some(1), None, path, out);
for (index, item) in self.allowed_energy_transfer.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyAllowedEnergyTransferRequest {}
impl Request for NotifyAllowedEnergyTransferRequest {
type Action = Action;
const ACTION: Action = Action::NotifyAllowedEnergyTransfer;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = NotifyAllowedEnergyTransferResponse;
}
impl Confirmed for NotifyAllowedEnergyTransferRequest {}
/// Spec: OCPP 2.1 · Q — Bidirectional Power Transfer · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyAllowedEnergyTransferResponse {
/// The `status` member.
pub status: NotifyAllowedEnergyTransferStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyAllowedEnergyTransferResponse {
/// Creates a `NotifyAllowedEnergyTransferResponse` from its required fields.
#[must_use]
pub fn new(status: NotifyAllowedEnergyTransferStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyAllowedEnergyTransferResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyAllowedEnergyTransferResponse {}
impl Response for NotifyAllowedEnergyTransferResponse {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyChargingLimitRequest {
/// The `chargingLimit` member.
#[serde(rename = "chargingLimit")]
pub charging_limit: ChargingLimit,
/// The `chargingSchedule` member.
#[serde(rename = "chargingSchedule")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub charging_schedule: Option<Vec<ChargingSchedule>>,
/// The EVSE to which the charging limit is set. If absent or when zero, it applies to the entire Charging Station.
#[serde(rename = "evseId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub evse_id: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyChargingLimitRequest {
/// Creates a `NotifyChargingLimitRequest` from its required fields.
#[must_use]
pub fn new(charging_limit: ChargingLimit) -> Self {
Self {
charging_limit,
charging_schedule: None,
evse_id: None,
custom_data: None,
}
}
/// Sets the optional `chargingSchedule` field.
#[must_use]
pub fn with_charging_schedule(mut self, value: Vec<ChargingSchedule>) -> Self {
self.charging_schedule = Some(value);
self
}
/// Sets the optional `evseId` field.
#[must_use]
pub fn with_evse_id(mut self, value: i32) -> Self {
self.evse_id = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyChargingLimitRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("chargingLimit");
Validate::validate_at(&self.charging_limit, path, out);
path.pop();
path.push_key("chargingSchedule");
if let Some(value) = &self.charging_schedule {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("evseId");
if let Some(value) = &self.evse_id {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyChargingLimitRequest {}
impl Request for NotifyChargingLimitRequest {
type Action = Action;
const ACTION: Action = Action::NotifyChargingLimit;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = NotifyChargingLimitResponse;
}
impl Confirmed for NotifyChargingLimitRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct NotifyChargingLimitResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyChargingLimitResponse {
/// Creates an empty `NotifyChargingLimitResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyChargingLimitResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyChargingLimitResponse {}
impl Response for NotifyChargingLimitResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyCustomerInformationRequest {
/// (Part of) the requested data. No format specified in which the data is returned. Should be human readable.
pub data: String,
/// Sequence number of this message. First message starts at 0.
#[serde(rename = "seqNo")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub seq_no: i32,
/// Timestamp of the moment this message was generated at the Charging Station.
#[serde(rename = "generatedAt")]
pub generated_at: crate::types::DateTime,
/// The Id of the request.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// “to be continued” indicator. Indicates whether another part of the monitoringData follows in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
/// Schema default: `false`.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tbc: Option<bool>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyCustomerInformationRequest {
/// Creates a `NotifyCustomerInformationRequest` from its required fields.
#[must_use]
pub fn new(
data: impl Into<String>,
seq_no: i32,
generated_at: impl Into<crate::types::DateTime>,
request_id: i32,
) -> Self {
Self {
data: data.into(),
seq_no,
generated_at: generated_at.into(),
request_id,
tbc: None,
custom_data: None,
}
}
/// Sets the optional `tbc` field.
#[must_use]
pub fn with_tbc(mut self, value: bool) -> Self {
self.tbc = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyCustomerInformationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("data");
validate::string(self.data.as_str(), None, Some(512), path, out);
path.pop();
path.push_key("seqNo");
validate::int_range(i64::from(self.seq_no), Some(0), None, path, out);
path.pop();
path.push_key("requestId");
validate::int_range(i64::from(self.request_id), Some(0), None, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyCustomerInformationRequest {}
impl Request for NotifyCustomerInformationRequest {
type Action = Action;
const ACTION: Action = Action::NotifyCustomerInformation;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = NotifyCustomerInformationResponse;
}
impl Confirmed for NotifyCustomerInformationRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct NotifyCustomerInformationResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyCustomerInformationResponse {
/// Creates an empty `NotifyCustomerInformationResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyCustomerInformationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyCustomerInformationResponse {}
impl Response for NotifyCustomerInformationResponse {}
/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyDERAlarmRequest {
/// The `controlType` member.
#[serde(rename = "controlType")]
pub control_type: DERControl,
/// Time of start or end of alarm.
pub timestamp: crate::types::DateTime,
/// The `gridEventFault` member.
#[serde(rename = "gridEventFault")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub grid_event_fault: Option<GridEventFault>,
/// True when error condition has ended.
/// Absent or false when alarm has started.
#[serde(rename = "alarmEnded")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub alarm_ended: Option<bool>,
/// Optional info provided by EV.
#[serde(rename = "extraInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub extra_info: Option<String>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyDERAlarmRequest {
/// Creates a `NotifyDERAlarmRequest` from its required fields.
#[must_use]
pub fn new(control_type: DERControl, timestamp: impl Into<crate::types::DateTime>) -> Self {
Self {
control_type,
timestamp: timestamp.into(),
grid_event_fault: None,
alarm_ended: None,
extra_info: None,
custom_data: None,
}
}
/// Sets the optional `gridEventFault` field.
#[must_use]
pub fn with_grid_event_fault(mut self, value: GridEventFault) -> Self {
self.grid_event_fault = Some(value);
self
}
/// Sets the optional `alarmEnded` field.
#[must_use]
pub fn with_alarm_ended(mut self, value: bool) -> Self {
self.alarm_ended = Some(value);
self
}
/// Sets the optional `extraInfo` field.
#[must_use]
pub fn with_extra_info(mut self, value: impl Into<String>) -> Self {
self.extra_info = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyDERAlarmRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("controlType");
Validate::validate_at(&self.control_type, path, out);
path.pop();
path.push_key("gridEventFault");
if let Some(value) = &self.grid_event_fault {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("extraInfo");
if let Some(value) = &self.extra_info {
validate::string(value.as_str(), None, Some(200), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyDERAlarmRequest {}
impl Request for NotifyDERAlarmRequest {
type Action = Action;
const ACTION: Action = Action::NotifyDERAlarm;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = NotifyDERAlarmResponse;
}
impl Confirmed for NotifyDERAlarmRequest {}
/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct NotifyDERAlarmResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyDERAlarmResponse {
/// Creates an empty `NotifyDERAlarmResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyDERAlarmResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyDERAlarmResponse {}
impl Response for NotifyDERAlarmResponse {}
/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyDERStartStopRequest {
/// Id of the started or stopped DER control.
/// Corresponds to the _controlId_ of the SetDERControlRequest.
#[serde(rename = "controlId")]
pub control_id: String,
/// True if DER control has started. False if it has ended.
pub started: bool,
/// Time of start or end of event.
pub timestamp: crate::types::DateTime,
/// List of controlIds that are superseded as a result of this control starting.
#[serde(rename = "supersededIds")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub superseded_ids: Option<Vec<String>>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyDERStartStopRequest {
/// Creates a `NotifyDERStartStopRequest` from its required fields.
#[must_use]
pub fn new(
control_id: impl Into<String>,
started: bool,
timestamp: impl Into<crate::types::DateTime>,
) -> Self {
Self {
control_id: control_id.into(),
started,
timestamp: timestamp.into(),
superseded_ids: None,
custom_data: None,
}
}
/// Sets the optional `supersededIds` field.
#[must_use]
pub fn with_superseded_ids(
mut self,
value: impl IntoIterator<Item = impl Into<String>>,
) -> Self {
self.superseded_ids = Some(value.into_iter().map(Into::into).collect());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyDERStartStopRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("controlId");
validate::string(self.control_id.as_str(), None, Some(36), path, out);
path.pop();
path.push_key("supersededIds");
if let Some(value) = &self.superseded_ids {
validate::list_len(value.len(), Some(1), Some(24), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
validate::string(item.as_str(), None, Some(36), path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyDERStartStopRequest {}
impl Request for NotifyDERStartStopRequest {
type Action = Action;
const ACTION: Action = Action::NotifyDERStartStop;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = NotifyDERStartStopResponse;
}
impl Confirmed for NotifyDERStartStopRequest {}
/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct NotifyDERStartStopResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyDERStartStopResponse {
/// Creates an empty `NotifyDERStartStopResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyDERStartStopResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyDERStartStopResponse {}
impl Response for NotifyDERStartStopResponse {}
/// Spec: OCPP 2.1 · O — Display Message · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyDisplayMessagesRequest {
/// The id of the <<getdisplaymessagesrequest,GetDisplayMessagesRequest>> that requested this message.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// The `messageInfo` member.
#[serde(rename = "messageInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message_info: Option<Vec<MessageInfo>>,
/// "to be continued" indicator. Indicates whether another part of the report follows in an upcoming NotifyDisplayMessagesRequest message. Default value when omitted is false.
/// Schema default: `false`.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tbc: Option<bool>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyDisplayMessagesRequest {
/// Creates a `NotifyDisplayMessagesRequest` from its required fields.
#[must_use]
pub fn new(request_id: i32) -> Self {
Self {
request_id,
message_info: None,
tbc: None,
custom_data: None,
}
}
/// Sets the optional `messageInfo` field.
#[must_use]
pub fn with_message_info(mut self, value: Vec<MessageInfo>) -> Self {
self.message_info = Some(value);
self
}
/// Sets the optional `tbc` field.
#[must_use]
pub fn with_tbc(mut self, value: bool) -> Self {
self.tbc = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyDisplayMessagesRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("messageInfo");
if let Some(value) = &self.message_info {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyDisplayMessagesRequest {}
impl Request for NotifyDisplayMessagesRequest {
type Action = Action;
const ACTION: Action = Action::NotifyDisplayMessages;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = NotifyDisplayMessagesResponse;
}
impl Confirmed for NotifyDisplayMessagesRequest {}
/// Spec: OCPP 2.1 · O — Display Message · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct NotifyDisplayMessagesResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyDisplayMessagesResponse {
/// Creates an empty `NotifyDisplayMessagesResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyDisplayMessagesResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyDisplayMessagesResponse {}
impl Response for NotifyDisplayMessagesResponse {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyEVChargingNeedsRequest {
/// Defines the EVSE and connector to which the EV is connected. EvseId may not be 0.
#[serde(rename = "evseId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub evse_id: i32,
/// The `chargingNeeds` member.
#[serde(rename = "chargingNeeds")]
pub charging_needs: ChargingNeeds,
/// Contains the maximum elements the EV supports for: +
/// - ISO 15118-2: schedule tuples in SASchedule (both Pmax and Tariff). +
/// - ISO 15118-20: PowerScheduleEntry, PriceRule and PriceLevelScheduleEntries.
#[serde(rename = "maxScheduleTuples")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub max_schedule_tuples: Option<i32>,
/// *(2.1)* Time when EV charging needs were received. +
/// Field can be added when charging station was offline when charging needs were received.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub timestamp: Option<crate::types::DateTime>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyEVChargingNeedsRequest {
/// Creates a `NotifyEVChargingNeedsRequest` from its required fields.
#[must_use]
pub fn new(evse_id: i32, charging_needs: ChargingNeeds) -> Self {
Self {
evse_id,
charging_needs,
max_schedule_tuples: None,
timestamp: None,
custom_data: None,
}
}
/// Sets the optional `maxScheduleTuples` field.
#[must_use]
pub fn with_max_schedule_tuples(mut self, value: i32) -> Self {
self.max_schedule_tuples = Some(value);
self
}
/// Sets the optional `timestamp` field.
#[must_use]
pub fn with_timestamp(mut self, value: impl Into<crate::types::DateTime>) -> Self {
self.timestamp = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyEVChargingNeedsRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("evseId");
validate::int_range(i64::from(self.evse_id), Some(1), None, path, out);
path.pop();
path.push_key("chargingNeeds");
Validate::validate_at(&self.charging_needs, path, out);
path.pop();
path.push_key("maxScheduleTuples");
if let Some(value) = &self.max_schedule_tuples {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyEVChargingNeedsRequest {}
impl Request for NotifyEVChargingNeedsRequest {
type Action = Action;
const ACTION: Action = Action::NotifyEVChargingNeeds;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = NotifyEVChargingNeedsResponse;
}
impl Confirmed for NotifyEVChargingNeedsRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyEVChargingNeedsResponse {
/// The `status` member.
pub status: NotifyEVChargingNeedsStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyEVChargingNeedsResponse {
/// Creates a `NotifyEVChargingNeedsResponse` from its required fields.
#[must_use]
pub fn new(status: NotifyEVChargingNeedsStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyEVChargingNeedsResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyEVChargingNeedsResponse {}
impl Response for NotifyEVChargingNeedsResponse {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyEVChargingScheduleRequest {
/// Periods contained in the charging profile are relative to this point in time.
#[serde(rename = "timeBase")]
pub time_base: crate::types::DateTime,
/// The `chargingSchedule` member.
#[serde(rename = "chargingSchedule")]
pub charging_schedule: ChargingSchedule,
/// The charging schedule contained in this notification applies to an EVSE. EvseId must be > 0.
#[serde(rename = "evseId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub evse_id: i32,
/// *(2.1)* Id of the _chargingSchedule_ that EV selected from the provided ChargingProfile.
#[serde(rename = "selectedChargingScheduleId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub selected_charging_schedule_id: Option<i32>,
/// *(2.1)* True when power tolerance is accepted by EV.
/// This value is taken from EVPowerProfile.PowerToleranceAcceptance in the ISO 15118-20 PowerDeliverReq message..
#[serde(rename = "powerToleranceAcceptance")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub power_tolerance_acceptance: Option<bool>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyEVChargingScheduleRequest {
/// Creates a `NotifyEVChargingScheduleRequest` from its required fields.
#[must_use]
pub fn new(
time_base: impl Into<crate::types::DateTime>,
charging_schedule: ChargingSchedule,
evse_id: i32,
) -> Self {
Self {
time_base: time_base.into(),
charging_schedule,
evse_id,
selected_charging_schedule_id: None,
power_tolerance_acceptance: None,
custom_data: None,
}
}
/// Sets the optional `selectedChargingScheduleId` field.
#[must_use]
pub fn with_selected_charging_schedule_id(mut self, value: i32) -> Self {
self.selected_charging_schedule_id = Some(value);
self
}
/// Sets the optional `powerToleranceAcceptance` field.
#[must_use]
pub fn with_power_tolerance_acceptance(mut self, value: bool) -> Self {
self.power_tolerance_acceptance = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyEVChargingScheduleRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("chargingSchedule");
Validate::validate_at(&self.charging_schedule, path, out);
path.pop();
path.push_key("evseId");
validate::int_range(i64::from(self.evse_id), Some(1), None, path, out);
path.pop();
path.push_key("selectedChargingScheduleId");
if let Some(value) = &self.selected_charging_schedule_id {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyEVChargingScheduleRequest {}
impl Request for NotifyEVChargingScheduleRequest {
type Action = Action;
const ACTION: Action = Action::NotifyEVChargingSchedule;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = NotifyEVChargingScheduleResponse;
}
impl Confirmed for NotifyEVChargingScheduleRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyEVChargingScheduleResponse {
/// The `status` member.
pub status: GenericStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyEVChargingScheduleResponse {
/// Creates a `NotifyEVChargingScheduleResponse` from its required fields.
#[must_use]
pub fn new(status: GenericStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyEVChargingScheduleResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyEVChargingScheduleResponse {}
impl Response for NotifyEVChargingScheduleResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyEventRequest {
/// Timestamp of the moment this message was generated at the Charging Station.
#[serde(rename = "generatedAt")]
pub generated_at: crate::types::DateTime,
/// Sequence number of this message. First message starts at 0.
#[serde(rename = "seqNo")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub seq_no: i32,
/// The `eventData` member.
#[serde(rename = "eventData")]
pub event_data: Vec<EventData>,
/// “to be continued” indicator. Indicates whether another part of the report follows in an upcoming notifyEventRequest message. Default value when omitted is false.
/// Schema default: `false`.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tbc: Option<bool>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyEventRequest {
/// Creates a `NotifyEventRequest` from its required fields.
#[must_use]
pub fn new(
generated_at: impl Into<crate::types::DateTime>,
seq_no: i32,
event_data: Vec<EventData>,
) -> Self {
Self {
generated_at: generated_at.into(),
seq_no,
event_data,
tbc: None,
custom_data: None,
}
}
/// Sets the optional `tbc` field.
#[must_use]
pub fn with_tbc(mut self, value: bool) -> Self {
self.tbc = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyEventRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("seqNo");
validate::int_range(i64::from(self.seq_no), Some(0), None, path, out);
path.pop();
path.push_key("eventData");
validate::list_len(self.event_data.len(), Some(1), None, path, out);
for (index, item) in self.event_data.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyEventRequest {}
impl Request for NotifyEventRequest {
type Action = Action;
const ACTION: Action = Action::NotifyEvent;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = NotifyEventResponse;
}
impl Confirmed for NotifyEventRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct NotifyEventResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyEventResponse {
/// Creates an empty `NotifyEventResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyEventResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyEventResponse {}
impl Response for NotifyEventResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyMonitoringReportRequest {
/// The id of the GetMonitoringRequest that requested this report.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// Sequence number of this message. First message starts at 0.
#[serde(rename = "seqNo")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub seq_no: i32,
/// Timestamp of the moment this message was generated at the Charging Station.
#[serde(rename = "generatedAt")]
pub generated_at: crate::types::DateTime,
/// The `monitor` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub monitor: Option<Vec<MonitoringData>>,
/// “to be continued” indicator. Indicates whether another part of the monitoringData follows in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
/// Schema default: `false`.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tbc: Option<bool>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyMonitoringReportRequest {
/// Creates a `NotifyMonitoringReportRequest` from its required fields.
#[must_use]
pub fn new(
request_id: i32,
seq_no: i32,
generated_at: impl Into<crate::types::DateTime>,
) -> Self {
Self {
request_id,
seq_no,
generated_at: generated_at.into(),
monitor: None,
tbc: None,
custom_data: None,
}
}
/// Sets the optional `monitor` field.
#[must_use]
pub fn with_monitor(mut self, value: Vec<MonitoringData>) -> Self {
self.monitor = Some(value);
self
}
/// Sets the optional `tbc` field.
#[must_use]
pub fn with_tbc(mut self, value: bool) -> Self {
self.tbc = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyMonitoringReportRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("seqNo");
validate::int_range(i64::from(self.seq_no), Some(0), None, path, out);
path.pop();
path.push_key("monitor");
if let Some(value) = &self.monitor {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyMonitoringReportRequest {}
impl Request for NotifyMonitoringReportRequest {
type Action = Action;
const ACTION: Action = Action::NotifyMonitoringReport;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = NotifyMonitoringReportResponse;
}
impl Confirmed for NotifyMonitoringReportRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct NotifyMonitoringReportResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyMonitoringReportResponse {
/// Creates an empty `NotifyMonitoringReportResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyMonitoringReportResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyMonitoringReportResponse {}
impl Response for NotifyMonitoringReportResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · SEND (unconfirmed, never answered — Part 4 §4.2.4).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyPeriodicEventStreamRequest {
/// The `data` member.
pub data: Vec<StreamDataElement>,
/// Id of stream.
#[serde(deserialize_with = "crate::types::integer::one")]
pub id: i32,
/// Number of data elements still pending to be sent.
#[serde(deserialize_with = "crate::types::integer::one")]
pub pending: i32,
/// Base timestamp to add to time offset of values.
pub basetime: crate::types::DateTime,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyPeriodicEventStreamRequest {
/// Creates a `NotifyPeriodicEventStreamRequest` from its required fields.
#[must_use]
pub fn new(
data: Vec<StreamDataElement>,
id: i32,
pending: i32,
basetime: impl Into<crate::types::DateTime>,
) -> Self {
Self {
data,
id,
pending,
basetime: basetime.into(),
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyPeriodicEventStreamRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("data");
validate::list_len(self.data.len(), Some(1), None, path, out);
for (index, item) in self.data.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("id");
validate::int_range(i64::from(self.id), Some(0), None, path, out);
path.pop();
path.push_key("pending");
validate::int_range(i64::from(self.pending), Some(0), None, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyPeriodicEventStreamRequest {}
impl Request for NotifyPeriodicEventStreamRequest {
type Action = Action;
const ACTION: Action = Action::NotifyPeriodicEventStream;
const KIND: MessageKind = MessageKind::Send;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = crate::message::NoResponse;
}
impl Unconfirmed for NotifyPeriodicEventStreamRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyPriorityChargingRequest {
/// The transaction for which priority charging is requested.
#[serde(rename = "transactionId")]
pub transaction_id: String,
/// True if priority charging was activated. False if it has stopped using the priority charging profile.
pub activated: bool,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyPriorityChargingRequest {
/// Creates a `NotifyPriorityChargingRequest` from its required fields.
#[must_use]
pub fn new(transaction_id: impl Into<String>, activated: bool) -> Self {
Self {
transaction_id: transaction_id.into(),
activated,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyPriorityChargingRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("transactionId");
validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyPriorityChargingRequest {}
impl Request for NotifyPriorityChargingRequest {
type Action = Action;
const ACTION: Action = Action::NotifyPriorityCharging;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = NotifyPriorityChargingResponse;
}
impl Confirmed for NotifyPriorityChargingRequest {}
/// This response message has an empty body.
///
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct NotifyPriorityChargingResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyPriorityChargingResponse {
/// Creates an empty `NotifyPriorityChargingResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyPriorityChargingResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyPriorityChargingResponse {}
impl Response for NotifyPriorityChargingResponse {}
/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyReportRequest {
/// The id of the GetReportRequest or GetBaseReportRequest that requested this report
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// Timestamp of the moment this message was generated at the Charging Station.
#[serde(rename = "generatedAt")]
pub generated_at: crate::types::DateTime,
/// Sequence number of this message. First message starts at 0.
#[serde(rename = "seqNo")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub seq_no: i32,
/// The `reportData` member.
#[serde(rename = "reportData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub report_data: Option<Vec<ReportData>>,
/// “to be continued” indicator. Indicates whether another part of the report follows in an upcoming notifyReportRequest message. Default value when omitted is false.
/// Schema default: `false`.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tbc: Option<bool>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyReportRequest {
/// Creates a `NotifyReportRequest` from its required fields.
#[must_use]
pub fn new(
request_id: i32,
generated_at: impl Into<crate::types::DateTime>,
seq_no: i32,
) -> Self {
Self {
request_id,
generated_at: generated_at.into(),
seq_no,
report_data: None,
tbc: None,
custom_data: None,
}
}
/// Sets the optional `reportData` field.
#[must_use]
pub fn with_report_data(mut self, value: Vec<ReportData>) -> Self {
self.report_data = Some(value);
self
}
/// Sets the optional `tbc` field.
#[must_use]
pub fn with_tbc(mut self, value: bool) -> Self {
self.tbc = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyReportRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("seqNo");
validate::int_range(i64::from(self.seq_no), Some(0), None, path, out);
path.pop();
path.push_key("reportData");
if let Some(value) = &self.report_data {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyReportRequest {}
impl Request for NotifyReportRequest {
type Action = Action;
const ACTION: Action = Action::NotifyReport;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = NotifyReportResponse;
}
impl Confirmed for NotifyReportRequest {}
/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct NotifyReportResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyReportResponse {
/// Creates an empty `NotifyReportResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyReportResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyReportResponse {}
impl Response for NotifyReportResponse {}
/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifySettlementRequest {
/// The payment reference received from the payment terminal and is used as the value for _idToken_.
#[serde(rename = "pspRef")]
pub psp_ref: String,
/// The `status` member.
pub status: PaymentStatus,
/// The amount that was settled, or attempted to be settled (in case of failure).
#[serde(rename = "settlementAmount")]
pub settlement_amount: crate::types::Decimal,
/// The time when the settlement was done.
#[serde(rename = "settlementTime")]
pub settlement_time: crate::types::DateTime,
/// The _transactionId_ that the settlement belongs to. Can be empty if the payment transaction is canceled prior to the start of the OCPP transaction.
#[serde(rename = "transactionId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub transaction_id: Option<String>,
/// Additional information from payment terminal/payment process.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<String>,
/// The `receiptId` member.
#[serde(rename = "receiptId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub receipt_id: Option<String>,
/// The receipt URL, to be used if the receipt is generated by the payment terminal or the CS.
#[serde(rename = "receiptUrl")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub receipt_url: Option<String>,
/// The `vatCompany` member.
#[serde(rename = "vatCompany")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub vat_company: Option<Address>,
/// VAT number for a company receipt.
#[serde(rename = "vatNumber")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub vat_number: Option<String>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifySettlementRequest {
/// Creates a `NotifySettlementRequest` from its required fields.
#[must_use]
pub fn new(
psp_ref: impl Into<String>,
status: PaymentStatus,
settlement_amount: impl Into<crate::types::Decimal>,
settlement_time: impl Into<crate::types::DateTime>,
) -> Self {
Self {
psp_ref: psp_ref.into(),
status,
settlement_amount: settlement_amount.into(),
settlement_time: settlement_time.into(),
transaction_id: None,
status_info: None,
receipt_id: None,
receipt_url: None,
vat_company: None,
vat_number: None,
custom_data: None,
}
}
/// Sets the optional `transactionId` field.
#[must_use]
pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
self.transaction_id = Some(value.into());
self
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: impl Into<String>) -> Self {
self.status_info = Some(value.into());
self
}
/// Sets the optional `receiptId` field.
#[must_use]
pub fn with_receipt_id(mut self, value: impl Into<String>) -> Self {
self.receipt_id = Some(value.into());
self
}
/// Sets the optional `receiptUrl` field.
#[must_use]
pub fn with_receipt_url(mut self, value: impl Into<String>) -> Self {
self.receipt_url = Some(value.into());
self
}
/// Sets the optional `vatCompany` field.
#[must_use]
pub fn with_vat_company(mut self, value: Address) -> Self {
self.vat_company = Some(value);
self
}
/// Sets the optional `vatNumber` field.
#[must_use]
pub fn with_vat_number(mut self, value: impl Into<String>) -> Self {
self.vat_number = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifySettlementRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("pspRef");
validate::string(self.psp_ref.as_str(), None, Some(255), path, out);
path.pop();
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("transactionId");
if let Some(value) = &self.transaction_id {
validate::string(value.as_str(), None, Some(36), path, out);
}
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
validate::string(value.as_str(), None, Some(500), path, out);
}
path.pop();
path.push_key("receiptId");
if let Some(value) = &self.receipt_id {
validate::string(value.as_str(), None, Some(50), path, out);
}
path.pop();
path.push_key("receiptUrl");
if let Some(value) = &self.receipt_url {
validate::string(value.as_str(), None, Some(2000), path, out);
}
path.pop();
path.push_key("vatCompany");
if let Some(value) = &self.vat_company {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("vatNumber");
if let Some(value) = &self.vat_number {
validate::string(value.as_str(), None, Some(20), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifySettlementRequest {}
impl Request for NotifySettlementRequest {
type Action = Action;
const ACTION: Action = Action::NotifySettlement;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = NotifySettlementResponse;
}
impl Confirmed for NotifySettlementRequest {}
/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct NotifySettlementResponse {
/// The receipt URL if receipt generated by CSMS. The Charging Station can QR encode it and show it to the EV Driver.
#[serde(rename = "receiptUrl")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub receipt_url: Option<String>,
/// The receipt id if the receipt is generated by CSMS.
#[serde(rename = "receiptId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub receipt_id: Option<String>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifySettlementResponse {
/// Creates an empty `NotifySettlementResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `receiptUrl` field.
#[must_use]
pub fn with_receipt_url(mut self, value: impl Into<String>) -> Self {
self.receipt_url = Some(value.into());
self
}
/// Sets the optional `receiptId` field.
#[must_use]
pub fn with_receipt_id(mut self, value: impl Into<String>) -> Self {
self.receipt_id = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifySettlementResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("receiptUrl");
if let Some(value) = &self.receipt_url {
validate::string(value.as_str(), None, Some(2000), path, out);
}
path.pop();
path.push_key("receiptId");
if let Some(value) = &self.receipt_id {
validate::string(value.as_str(), None, Some(50), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifySettlementResponse {}
impl Response for NotifySettlementResponse {}
/// Spec: OCPP 2.1 · C — Authorization · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotifyWebPaymentStartedRequest {
/// EVSE id for which transaction is requested.
#[serde(rename = "evseId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub evse_id: i32,
/// Timeout value in seconds after which no result of web payment process (e.g. QR code scanning) is to be expected anymore.
#[serde(deserialize_with = "crate::types::integer::one")]
pub timeout: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyWebPaymentStartedRequest {
/// Creates a `NotifyWebPaymentStartedRequest` from its required fields.
#[must_use]
pub fn new(evse_id: i32, timeout: i32) -> Self {
Self {
evse_id,
timeout,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyWebPaymentStartedRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("evseId");
validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyWebPaymentStartedRequest {}
impl Request for NotifyWebPaymentStartedRequest {
type Action = Action;
const ACTION: Action = Action::NotifyWebPaymentStarted;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = NotifyWebPaymentStartedResponse;
}
impl Confirmed for NotifyWebPaymentStartedRequest {}
/// Spec: OCPP 2.1 · C — Authorization · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct NotifyWebPaymentStartedResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl NotifyWebPaymentStartedResponse {
/// Creates an empty `NotifyWebPaymentStartedResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for NotifyWebPaymentStartedResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for NotifyWebPaymentStartedResponse {}
impl Response for NotifyWebPaymentStartedResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct OpenPeriodicEventStreamRequest {
/// The `constantStreamData` member.
#[serde(rename = "constantStreamData")]
pub constant_stream_data: ConstantStreamData,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl OpenPeriodicEventStreamRequest {
/// Creates a `OpenPeriodicEventStreamRequest` from its required fields.
#[must_use]
pub fn new(constant_stream_data: ConstantStreamData) -> Self {
Self {
constant_stream_data,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for OpenPeriodicEventStreamRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("constantStreamData");
Validate::validate_at(&self.constant_stream_data, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for OpenPeriodicEventStreamRequest {}
impl Request for OpenPeriodicEventStreamRequest {
type Action = Action;
const ACTION: Action = Action::OpenPeriodicEventStream;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = OpenPeriodicEventStreamResponse;
}
impl Confirmed for OpenPeriodicEventStreamRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct OpenPeriodicEventStreamResponse {
/// The `status` member.
pub status: GenericStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl OpenPeriodicEventStreamResponse {
/// Creates a `OpenPeriodicEventStreamResponse` from its required fields.
#[must_use]
pub fn new(status: GenericStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for OpenPeriodicEventStreamResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for OpenPeriodicEventStreamResponse {}
impl Response for OpenPeriodicEventStreamResponse {}
/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct PublishFirmwareRequest {
/// This contains a string containing a URI pointing to a
/// location from which to retrieve the firmware.
pub location: String,
/// The MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
pub checksum: String,
/// The Id of the request.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// This specifies how many times Charging Station must retry
/// 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.
/// If the value is 0, it means: no retries.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub retries: Option<i32>,
/// 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.
#[serde(rename = "retryInterval")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub retry_interval: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl PublishFirmwareRequest {
/// Creates a `PublishFirmwareRequest` from its required fields.
#[must_use]
pub fn new(location: impl Into<String>, checksum: impl Into<String>, request_id: i32) -> Self {
Self {
location: location.into(),
checksum: checksum.into(),
request_id,
retries: None,
retry_interval: None,
custom_data: None,
}
}
/// Sets the optional `retries` field.
#[must_use]
pub fn with_retries(mut self, value: i32) -> Self {
self.retries = Some(value);
self
}
/// Sets the optional `retryInterval` field.
#[must_use]
pub fn with_retry_interval(mut self, value: i32) -> Self {
self.retry_interval = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for PublishFirmwareRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("location");
validate::string(self.location.as_str(), None, Some(2000), path, out);
path.pop();
path.push_key("checksum");
validate::string(self.checksum.as_str(), None, Some(32), path, out);
path.pop();
path.push_key("requestId");
validate::int_range(i64::from(self.request_id), Some(0), None, path, out);
path.pop();
path.push_key("retries");
if let Some(value) = &self.retries {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("retryInterval");
if let Some(value) = &self.retry_interval {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for PublishFirmwareRequest {}
impl Request for PublishFirmwareRequest {
type Action = Action;
const ACTION: Action = Action::PublishFirmware;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = PublishFirmwareResponse;
}
impl Confirmed for PublishFirmwareRequest {}
/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct PublishFirmwareResponse {
/// The `status` member.
pub status: GenericStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl PublishFirmwareResponse {
/// Creates a `PublishFirmwareResponse` from its required fields.
#[must_use]
pub fn new(status: GenericStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for PublishFirmwareResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for PublishFirmwareResponse {}
impl Response for PublishFirmwareResponse {}
/// Spec: OCPP 2.1 · L — Firmware Management · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct PublishFirmwareStatusNotificationRequest {
/// The `status` member.
pub status: PublishFirmwareStatus,
/// Required if status is Published. Can be multiple URI’s, if the Local Controller supports e.g. HTTP, HTTPS, and FTP.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub location: Option<Vec<String>>,
/// The request id that was
/// provided in the
/// PublishFirmwareRequest which
/// triggered this action.
#[serde(rename = "requestId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub request_id: Option<i32>,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl PublishFirmwareStatusNotificationRequest {
/// Creates a `PublishFirmwareStatusNotificationRequest` from its required fields.
#[must_use]
pub fn new(status: PublishFirmwareStatus) -> Self {
Self {
status,
location: None,
request_id: None,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `location` field.
#[must_use]
pub fn with_location(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
self.location = Some(value.into_iter().map(Into::into).collect());
self
}
/// Sets the optional `requestId` field.
#[must_use]
pub fn with_request_id(mut self, value: i32) -> Self {
self.request_id = Some(value);
self
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for PublishFirmwareStatusNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("location");
if let Some(value) = &self.location {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
validate::string(item.as_str(), None, Some(2000), path, out);
path.pop();
}
}
path.pop();
path.push_key("requestId");
if let Some(value) = &self.request_id {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for PublishFirmwareStatusNotificationRequest {}
impl Request for PublishFirmwareStatusNotificationRequest {
type Action = Action;
const ACTION: Action = Action::PublishFirmwareStatusNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = PublishFirmwareStatusNotificationResponse;
}
impl Confirmed for PublishFirmwareStatusNotificationRequest {}
/// Spec: OCPP 2.1 · L — Firmware Management · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct PublishFirmwareStatusNotificationResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl PublishFirmwareStatusNotificationResponse {
/// Creates an empty `PublishFirmwareStatusNotificationResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for PublishFirmwareStatusNotificationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for PublishFirmwareStatusNotificationResponse {}
impl Response for PublishFirmwareStatusNotificationResponse {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct PullDynamicScheduleUpdateRequest {
/// Id of charging profile to update.
#[serde(rename = "chargingProfileId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub charging_profile_id: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl PullDynamicScheduleUpdateRequest {
/// Creates a `PullDynamicScheduleUpdateRequest` from its required fields.
#[must_use]
pub fn new(charging_profile_id: i32) -> Self {
Self {
charging_profile_id,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for PullDynamicScheduleUpdateRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for PullDynamicScheduleUpdateRequest {}
impl Request for PullDynamicScheduleUpdateRequest {
type Action = Action;
const ACTION: Action = Action::PullDynamicScheduleUpdate;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = PullDynamicScheduleUpdateResponse;
}
impl Confirmed for PullDynamicScheduleUpdateRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct PullDynamicScheduleUpdateResponse {
/// The `status` member.
pub status: ChargingProfileStatus,
/// The `scheduleUpdate` member.
#[serde(rename = "scheduleUpdate")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub schedule_update: Option<ChargingScheduleUpdate>,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl PullDynamicScheduleUpdateResponse {
/// Creates a `PullDynamicScheduleUpdateResponse` from its required fields.
#[must_use]
pub fn new(status: ChargingProfileStatus) -> Self {
Self {
status,
schedule_update: None,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `scheduleUpdate` field.
#[must_use]
pub fn with_schedule_update(mut self, value: ChargingScheduleUpdate) -> Self {
self.schedule_update = Some(value);
self
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for PullDynamicScheduleUpdateResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("scheduleUpdate");
if let Some(value) = &self.schedule_update {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for PullDynamicScheduleUpdateResponse {}
impl Response for PullDynamicScheduleUpdateResponse {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ReportChargingProfilesRequest {
/// Id used to match the <<getchargingprofilesrequest, GetChargingProfilesRequest>> message with the resulting ReportChargingProfilesRequest messages. When the CSMS provided a requestId in the <<getchargingprofilesrequest, GetChargingProfilesRequest>>, this field SHALL contain the same value.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// Source that has installed this charging profile. Values defined in Appendix as ChargingLimitSourceEnumStringType.
#[serde(rename = "chargingLimitSource")]
pub charging_limit_source: String,
/// The `chargingProfile` member.
#[serde(rename = "chargingProfile")]
pub charging_profile: Vec<ChargingProfile>,
/// The evse to which the charging profile applies. If evseId = 0, the message contains an overall limit for the Charging Station.
#[serde(rename = "evseId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub evse_id: i32,
/// To Be Continued. Default value when omitted: false. false indicates that there are no further messages as part of this report.
/// Schema default: `false`.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tbc: Option<bool>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ReportChargingProfilesRequest {
/// Creates a `ReportChargingProfilesRequest` from its required fields.
#[must_use]
pub fn new(
request_id: i32,
charging_limit_source: impl Into<String>,
charging_profile: Vec<ChargingProfile>,
evse_id: i32,
) -> Self {
Self {
request_id,
charging_limit_source: charging_limit_source.into(),
charging_profile,
evse_id,
tbc: None,
custom_data: None,
}
}
/// Sets the optional `tbc` field.
#[must_use]
pub fn with_tbc(mut self, value: bool) -> Self {
self.tbc = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ReportChargingProfilesRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("chargingLimitSource");
validate::string(
self.charging_limit_source.as_str(),
None,
Some(20),
path,
out,
);
path.pop();
path.push_key("chargingProfile");
validate::list_len(self.charging_profile.len(), Some(1), None, path, out);
for (index, item) in self.charging_profile.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("evseId");
validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ReportChargingProfilesRequest {}
impl Request for ReportChargingProfilesRequest {
type Action = Action;
const ACTION: Action = Action::ReportChargingProfiles;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = ReportChargingProfilesResponse;
}
impl Confirmed for ReportChargingProfilesRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ReportChargingProfilesResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ReportChargingProfilesResponse {
/// Creates an empty `ReportChargingProfilesResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ReportChargingProfilesResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ReportChargingProfilesResponse {}
impl Response for ReportChargingProfilesResponse {}
/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ReportDERControlRequest {
/// RequestId from GetDERControlRequest.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// The `curve` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub curve: Option<Vec<DERCurveGet>>,
/// The `enterService` member.
#[serde(rename = "enterService")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub enter_service: Option<Vec<EnterServiceGet>>,
/// The `fixedPFAbsorb` member.
#[serde(rename = "fixedPFAbsorb")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub fixed_pf_absorb: Option<Vec<FixedPFGet>>,
/// The `fixedPFInject` member.
#[serde(rename = "fixedPFInject")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub fixed_pf_inject: Option<Vec<FixedPFGet>>,
/// The `fixedVar` member.
#[serde(rename = "fixedVar")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub fixed_var: Option<Vec<FixedVarGet>>,
/// The `freqDroop` member.
#[serde(rename = "freqDroop")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub freq_droop: Option<Vec<FreqDroopGet>>,
/// The `gradient` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub gradient: Option<Vec<GradientGet>>,
/// The `limitMaxDischarge` member.
#[serde(rename = "limitMaxDischarge")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub limit_max_discharge: Option<Vec<LimitMaxDischargeGet>>,
/// To Be Continued. Default value when omitted: false. +
/// False indicates that there are no further messages as part of this report.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tbc: Option<bool>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ReportDERControlRequest {
/// Creates a `ReportDERControlRequest` from its required fields.
#[must_use]
pub fn new(request_id: i32) -> Self {
Self {
request_id,
curve: None,
enter_service: None,
fixed_pf_absorb: None,
fixed_pf_inject: None,
fixed_var: None,
freq_droop: None,
gradient: None,
limit_max_discharge: None,
tbc: None,
custom_data: None,
}
}
/// Sets the optional `curve` field.
#[must_use]
pub fn with_curve(mut self, value: Vec<DERCurveGet>) -> Self {
self.curve = Some(value);
self
}
/// Sets the optional `enterService` field.
#[must_use]
pub fn with_enter_service(mut self, value: Vec<EnterServiceGet>) -> Self {
self.enter_service = Some(value);
self
}
/// Sets the optional `fixedPFAbsorb` field.
#[must_use]
pub fn with_fixed_pf_absorb(mut self, value: Vec<FixedPFGet>) -> Self {
self.fixed_pf_absorb = Some(value);
self
}
/// Sets the optional `fixedPFInject` field.
#[must_use]
pub fn with_fixed_pf_inject(mut self, value: Vec<FixedPFGet>) -> Self {
self.fixed_pf_inject = Some(value);
self
}
/// Sets the optional `fixedVar` field.
#[must_use]
pub fn with_fixed_var(mut self, value: Vec<FixedVarGet>) -> Self {
self.fixed_var = Some(value);
self
}
/// Sets the optional `freqDroop` field.
#[must_use]
pub fn with_freq_droop(mut self, value: Vec<FreqDroopGet>) -> Self {
self.freq_droop = Some(value);
self
}
/// Sets the optional `gradient` field.
#[must_use]
pub fn with_gradient(mut self, value: Vec<GradientGet>) -> Self {
self.gradient = Some(value);
self
}
/// Sets the optional `limitMaxDischarge` field.
#[must_use]
pub fn with_limit_max_discharge(mut self, value: Vec<LimitMaxDischargeGet>) -> Self {
self.limit_max_discharge = Some(value);
self
}
/// Sets the optional `tbc` field.
#[must_use]
pub fn with_tbc(mut self, value: bool) -> Self {
self.tbc = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ReportDERControlRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("curve");
if let Some(value) = &self.curve {
validate::list_len(value.len(), Some(1), Some(24), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("enterService");
if let Some(value) = &self.enter_service {
validate::list_len(value.len(), Some(1), Some(24), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("fixedPFAbsorb");
if let Some(value) = &self.fixed_pf_absorb {
validate::list_len(value.len(), Some(1), Some(24), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("fixedPFInject");
if let Some(value) = &self.fixed_pf_inject {
validate::list_len(value.len(), Some(1), Some(24), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("fixedVar");
if let Some(value) = &self.fixed_var {
validate::list_len(value.len(), Some(1), Some(24), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("freqDroop");
if let Some(value) = &self.freq_droop {
validate::list_len(value.len(), Some(1), Some(24), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("gradient");
if let Some(value) = &self.gradient {
validate::list_len(value.len(), Some(1), Some(24), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("limitMaxDischarge");
if let Some(value) = &self.limit_max_discharge {
validate::list_len(value.len(), Some(1), Some(24), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ReportDERControlRequest {}
impl Request for ReportDERControlRequest {
type Action = Action;
const ACTION: Action = Action::ReportDERControl;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = ReportDERControlResponse;
}
impl Confirmed for ReportDERControlRequest {}
/// This message has no parameters.
///
/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ReportDERControlResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ReportDERControlResponse {
/// Creates an empty `ReportDERControlResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ReportDERControlResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ReportDERControlResponse {}
impl Response for ReportDERControlResponse {}
/// Spec: OCPP 2.1 · S — Battery Swapping · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RequestBatterySwapRequest {
/// The `idToken` member.
#[serde(rename = "idToken")]
pub id_token: IdToken,
/// Request id to match with BatterySwapRequest.
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl RequestBatterySwapRequest {
/// Creates a `RequestBatterySwapRequest` from its required fields.
#[must_use]
pub fn new(id_token: IdToken, request_id: i32) -> Self {
Self {
id_token,
request_id,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for RequestBatterySwapRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idToken");
Validate::validate_at(&self.id_token, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for RequestBatterySwapRequest {}
impl Request for RequestBatterySwapRequest {
type Action = Action;
const ACTION: Action = Action::RequestBatterySwap;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = RequestBatterySwapResponse;
}
impl Confirmed for RequestBatterySwapRequest {}
/// Spec: OCPP 2.1 · S — Battery Swapping · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RequestBatterySwapResponse {
/// The `status` member.
pub status: GenericStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl RequestBatterySwapResponse {
/// Creates a `RequestBatterySwapResponse` from its required fields.
#[must_use]
pub fn new(status: GenericStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for RequestBatterySwapResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for RequestBatterySwapResponse {}
impl Response for RequestBatterySwapResponse {}
/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RequestStartTransactionRequest {
/// The `idToken` member.
#[serde(rename = "idToken")]
pub id_token: IdToken,
/// Id given by the server to this start request. The Charging Station will return this in the <<transactioneventrequest, TransactionEventRequest>>, letting the server know which transaction was started for this request. Use to start a transaction.
#[serde(rename = "remoteStartId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub remote_start_id: i32,
/// Number of the EVSE on which to start the transaction. EvseId SHALL be > 0
#[serde(rename = "evseId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub evse_id: Option<i32>,
/// The `groupIdToken` member.
#[serde(rename = "groupIdToken")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub group_id_token: Option<IdToken>,
/// The `chargingProfile` member.
#[serde(rename = "chargingProfile")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub charging_profile: Option<ChargingProfile>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl RequestStartTransactionRequest {
/// Creates a `RequestStartTransactionRequest` from its required fields.
#[must_use]
pub fn new(id_token: IdToken, remote_start_id: i32) -> Self {
Self {
id_token,
remote_start_id,
evse_id: None,
group_id_token: None,
charging_profile: None,
custom_data: None,
}
}
/// Sets the optional `evseId` field.
#[must_use]
pub fn with_evse_id(mut self, value: i32) -> Self {
self.evse_id = Some(value);
self
}
/// Sets the optional `groupIdToken` field.
#[must_use]
pub fn with_group_id_token(mut self, value: IdToken) -> Self {
self.group_id_token = Some(value);
self
}
/// Sets the optional `chargingProfile` field.
#[must_use]
pub fn with_charging_profile(mut self, value: ChargingProfile) -> Self {
self.charging_profile = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for RequestStartTransactionRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idToken");
Validate::validate_at(&self.id_token, path, out);
path.pop();
path.push_key("evseId");
if let Some(value) = &self.evse_id {
validate::int_range(i64::from(*value), Some(1), None, path, out);
}
path.pop();
path.push_key("groupIdToken");
if let Some(value) = &self.group_id_token {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("chargingProfile");
if let Some(value) = &self.charging_profile {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for RequestStartTransactionRequest {}
impl Request for RequestStartTransactionRequest {
type Action = Action;
const ACTION: Action = Action::RequestStartTransaction;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = RequestStartTransactionResponse;
}
impl Confirmed for RequestStartTransactionRequest {}
/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RequestStartTransactionResponse {
/// The `status` member.
pub status: RequestStartStopStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<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.
#[serde(rename = "transactionId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub transaction_id: Option<String>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl RequestStartTransactionResponse {
/// Creates a `RequestStartTransactionResponse` from its required fields.
#[must_use]
pub fn new(status: RequestStartStopStatus) -> Self {
Self {
status,
status_info: None,
transaction_id: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `transactionId` field.
#[must_use]
pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
self.transaction_id = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for RequestStartTransactionResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("transactionId");
if let Some(value) = &self.transaction_id {
validate::string(value.as_str(), None, Some(36), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for RequestStartTransactionResponse {}
impl Response for RequestStartTransactionResponse {}
/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RequestStopTransactionRequest {
/// The identifier of the transaction which the Charging Station is requested to stop.
#[serde(rename = "transactionId")]
pub transaction_id: String,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl RequestStopTransactionRequest {
/// Creates a `RequestStopTransactionRequest` from its required fields.
#[must_use]
pub fn new(transaction_id: impl Into<String>) -> Self {
Self {
transaction_id: transaction_id.into(),
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for RequestStopTransactionRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("transactionId");
validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for RequestStopTransactionRequest {}
impl Request for RequestStopTransactionRequest {
type Action = Action;
const ACTION: Action = Action::RequestStopTransaction;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = RequestStopTransactionResponse;
}
impl Confirmed for RequestStopTransactionRequest {}
/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RequestStopTransactionResponse {
/// The `status` member.
pub status: RequestStartStopStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl RequestStopTransactionResponse {
/// Creates a `RequestStopTransactionResponse` from its required fields.
#[must_use]
pub fn new(status: RequestStartStopStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for RequestStopTransactionResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for RequestStopTransactionResponse {}
impl Response for RequestStopTransactionResponse {}
/// Spec: OCPP 2.1 · H — Reservation · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ReservationStatusUpdateRequest {
/// The ID of the reservation.
#[serde(rename = "reservationId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub reservation_id: i32,
/// The `reservationUpdateStatus` member.
#[serde(rename = "reservationUpdateStatus")]
pub reservation_update_status: ReservationUpdateStatus,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ReservationStatusUpdateRequest {
/// Creates a `ReservationStatusUpdateRequest` from its required fields.
#[must_use]
pub fn new(reservation_id: i32, reservation_update_status: ReservationUpdateStatus) -> Self {
Self {
reservation_id,
reservation_update_status,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ReservationStatusUpdateRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("reservationId");
validate::int_range(i64::from(self.reservation_id), Some(0), None, path, out);
path.pop();
path.push_key("reservationUpdateStatus");
Validate::validate_at(&self.reservation_update_status, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ReservationStatusUpdateRequest {}
impl Request for ReservationStatusUpdateRequest {
type Action = Action;
const ACTION: Action = Action::ReservationStatusUpdate;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = ReservationStatusUpdateResponse;
}
impl Confirmed for ReservationStatusUpdateRequest {}
/// Spec: OCPP 2.1 · H — Reservation · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ReservationStatusUpdateResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ReservationStatusUpdateResponse {
/// Creates an empty `ReservationStatusUpdateResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ReservationStatusUpdateResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ReservationStatusUpdateResponse {}
impl Response for ReservationStatusUpdateResponse {}
/// Spec: OCPP 2.1 · H — Reservation · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ReserveNowRequest {
/// Id of reservation.
#[serde(deserialize_with = "crate::types::integer::one")]
pub id: i32,
/// Date and time at which the reservation expires.
#[serde(rename = "expiryDateTime")]
pub expiry_date_time: crate::types::DateTime,
/// The `idToken` member.
#[serde(rename = "idToken")]
pub id_token: IdToken,
/// This field specifies the connector type. Values defined in Appendix as ConnectorEnumStringType.
#[serde(rename = "connectorType")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub connector_type: Option<String>,
/// This contains ID of the evse to be reserved.
#[serde(rename = "evseId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub evse_id: Option<i32>,
/// The `groupIdToken` member.
#[serde(rename = "groupIdToken")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub group_id_token: Option<IdToken>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ReserveNowRequest {
/// Creates a `ReserveNowRequest` from its required fields.
#[must_use]
pub fn new(
id: i32,
expiry_date_time: impl Into<crate::types::DateTime>,
id_token: IdToken,
) -> Self {
Self {
id,
expiry_date_time: expiry_date_time.into(),
id_token,
connector_type: None,
evse_id: None,
group_id_token: None,
custom_data: None,
}
}
/// Sets the optional `connectorType` field.
#[must_use]
pub fn with_connector_type(mut self, value: impl Into<String>) -> Self {
self.connector_type = Some(value.into());
self
}
/// Sets the optional `evseId` field.
#[must_use]
pub fn with_evse_id(mut self, value: i32) -> Self {
self.evse_id = Some(value);
self
}
/// Sets the optional `groupIdToken` field.
#[must_use]
pub fn with_group_id_token(mut self, value: IdToken) -> Self {
self.group_id_token = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ReserveNowRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("id");
validate::int_range(i64::from(self.id), Some(0), None, path, out);
path.pop();
path.push_key("idToken");
Validate::validate_at(&self.id_token, path, out);
path.pop();
path.push_key("connectorType");
if let Some(value) = &self.connector_type {
validate::string(value.as_str(), None, Some(20), path, out);
}
path.pop();
path.push_key("evseId");
if let Some(value) = &self.evse_id {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("groupIdToken");
if let Some(value) = &self.group_id_token {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ReserveNowRequest {}
impl Request for ReserveNowRequest {
type Action = Action;
const ACTION: Action = Action::ReserveNow;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ReserveNowResponse;
}
impl Confirmed for ReserveNowRequest {}
/// Spec: OCPP 2.1 · H — Reservation · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ReserveNowResponse {
/// The `status` member.
pub status: ReserveNowStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ReserveNowResponse {
/// Creates a `ReserveNowResponse` from its required fields.
#[must_use]
pub fn new(status: ReserveNowStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ReserveNowResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ReserveNowResponse {}
impl Response for ReserveNowResponse {}
/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ResetRequest {
/// The `type` member.
pub r#type: ResetEnum,
/// This contains the ID of a specific EVSE that needs to be reset, instead of the entire Charging Station.
#[serde(rename = "evseId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub evse_id: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ResetRequest {
/// Creates a `ResetRequest` from its required fields.
#[must_use]
pub fn new(r#type: ResetEnum) -> Self {
Self {
r#type,
evse_id: None,
custom_data: None,
}
}
/// Sets the optional `evseId` field.
#[must_use]
pub fn with_evse_id(mut self, value: i32) -> Self {
self.evse_id = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ResetRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("type");
Validate::validate_at(&self.r#type, path, out);
path.pop();
path.push_key("evseId");
if let Some(value) = &self.evse_id {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ResetRequest {}
impl Request for ResetRequest {
type Action = Action;
const ACTION: Action = Action::Reset;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = ResetResponse;
}
impl Confirmed for ResetRequest {}
/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ResetResponse {
/// The `status` member.
pub status: ResetStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl ResetResponse {
/// Creates a `ResetResponse` from its required fields.
#[must_use]
pub fn new(status: ResetStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for ResetResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for ResetResponse {}
impl Response for ResetResponse {}
/// Spec: OCPP 2.1 · A — Security · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SecurityEventNotificationRequest {
/// Type of the security event. This value should be taken from the Security events list.
pub r#type: String,
/// Date and time at which the event occurred.
pub timestamp: crate::types::DateTime,
/// Additional information about the occurred security event.
#[serde(rename = "techInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tech_info: Option<String>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SecurityEventNotificationRequest {
/// Creates a `SecurityEventNotificationRequest` from its required fields.
#[must_use]
pub fn new(r#type: impl Into<String>, timestamp: impl Into<crate::types::DateTime>) -> Self {
Self {
r#type: r#type.into(),
timestamp: timestamp.into(),
tech_info: None,
custom_data: None,
}
}
/// Sets the optional `techInfo` field.
#[must_use]
pub fn with_tech_info(mut self, value: impl Into<String>) -> Self {
self.tech_info = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SecurityEventNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("type");
validate::string(self.r#type.as_str(), None, Some(50), path, out);
path.pop();
path.push_key("techInfo");
if let Some(value) = &self.tech_info {
validate::string(value.as_str(), None, Some(255), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SecurityEventNotificationRequest {}
impl Request for SecurityEventNotificationRequest {
type Action = Action;
const ACTION: Action = Action::SecurityEventNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = SecurityEventNotificationResponse;
}
impl Confirmed for SecurityEventNotificationRequest {}
/// Spec: OCPP 2.1 · A — Security · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct SecurityEventNotificationResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SecurityEventNotificationResponse {
/// Creates an empty `SecurityEventNotificationResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SecurityEventNotificationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SecurityEventNotificationResponse {}
impl Response for SecurityEventNotificationResponse {}
/// Spec: OCPP 2.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SendLocalListRequest {
/// 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.
#[serde(rename = "versionNumber")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub version_number: i32,
/// The `updateType` member.
#[serde(rename = "updateType")]
pub update_type: Update,
/// The `localAuthorizationList` member.
#[serde(rename = "localAuthorizationList")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub local_authorization_list: Option<Vec<AuthorizationData>>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SendLocalListRequest {
/// Creates a `SendLocalListRequest` from its required fields.
#[must_use]
pub fn new(version_number: i32, update_type: Update) -> Self {
Self {
version_number,
update_type,
local_authorization_list: None,
custom_data: None,
}
}
/// Sets the optional `localAuthorizationList` field.
#[must_use]
pub fn with_local_authorization_list(mut self, value: Vec<AuthorizationData>) -> Self {
self.local_authorization_list = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SendLocalListRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("updateType");
Validate::validate_at(&self.update_type, path, out);
path.pop();
path.push_key("localAuthorizationList");
if let Some(value) = &self.local_authorization_list {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SendLocalListRequest {}
impl Request for SendLocalListRequest {
type Action = Action;
const ACTION: Action = Action::SendLocalList;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SendLocalListResponse;
}
impl Confirmed for SendLocalListRequest {}
/// Spec: OCPP 2.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SendLocalListResponse {
/// The `status` member.
pub status: SendLocalListStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SendLocalListResponse {
/// Creates a `SendLocalListResponse` from its required fields.
#[must_use]
pub fn new(status: SendLocalListStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SendLocalListResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SendLocalListResponse {}
impl Response for SendLocalListResponse {}
/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetChargingProfileRequest {
/// 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.
#[serde(rename = "evseId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub evse_id: i32,
/// The `chargingProfile` member.
#[serde(rename = "chargingProfile")]
pub charging_profile: ChargingProfile,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetChargingProfileRequest {
/// Creates a `SetChargingProfileRequest` from its required fields.
#[must_use]
pub fn new(evse_id: i32, charging_profile: ChargingProfile) -> Self {
Self {
evse_id,
charging_profile,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetChargingProfileRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("evseId");
validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
path.pop();
path.push_key("chargingProfile");
Validate::validate_at(&self.charging_profile, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetChargingProfileRequest {}
impl Request for SetChargingProfileRequest {
type Action = Action;
const ACTION: Action = Action::SetChargingProfile;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SetChargingProfileResponse;
}
impl Confirmed for SetChargingProfileRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetChargingProfileResponse {
/// The `status` member.
pub status: ChargingProfileStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetChargingProfileResponse {
/// Creates a `SetChargingProfileResponse` from its required fields.
#[must_use]
pub fn new(status: ChargingProfileStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetChargingProfileResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetChargingProfileResponse {}
impl Response for SetChargingProfileResponse {}
/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetDERControlRequest {
/// True if this is a default DER control
#[serde(rename = "isDefault")]
pub is_default: bool,
/// Unique id of this control, e.g. UUID
#[serde(rename = "controlId")]
pub control_id: String,
/// The `controlType` member.
#[serde(rename = "controlType")]
pub control_type: DERControl,
/// The `curve` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub curve: Option<DERCurve>,
/// The `enterService` member.
#[serde(rename = "enterService")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub enter_service: Option<EnterService>,
/// The `fixedPFAbsorb` member.
#[serde(rename = "fixedPFAbsorb")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub fixed_pf_absorb: Option<FixedPF>,
/// The `fixedPFInject` member.
#[serde(rename = "fixedPFInject")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub fixed_pf_inject: Option<FixedPF>,
/// The `fixedVar` member.
#[serde(rename = "fixedVar")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub fixed_var: Option<FixedVar>,
/// The `freqDroop` member.
#[serde(rename = "freqDroop")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub freq_droop: Option<FreqDroop>,
/// The `gradient` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub gradient: Option<Gradient>,
/// The `limitMaxDischarge` member.
#[serde(rename = "limitMaxDischarge")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub limit_max_discharge: Option<LimitMaxDischarge>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetDERControlRequest {
/// Creates a `SetDERControlRequest` from its required fields.
#[must_use]
pub fn new(is_default: bool, control_id: impl Into<String>, control_type: DERControl) -> Self {
Self {
is_default,
control_id: control_id.into(),
control_type,
curve: None,
enter_service: None,
fixed_pf_absorb: None,
fixed_pf_inject: None,
fixed_var: None,
freq_droop: None,
gradient: None,
limit_max_discharge: None,
custom_data: None,
}
}
/// Sets the optional `curve` field.
#[must_use]
pub fn with_curve(mut self, value: DERCurve) -> Self {
self.curve = Some(value);
self
}
/// Sets the optional `enterService` field.
#[must_use]
pub fn with_enter_service(mut self, value: EnterService) -> Self {
self.enter_service = Some(value);
self
}
/// Sets the optional `fixedPFAbsorb` field.
#[must_use]
pub fn with_fixed_pf_absorb(mut self, value: FixedPF) -> Self {
self.fixed_pf_absorb = Some(value);
self
}
/// Sets the optional `fixedPFInject` field.
#[must_use]
pub fn with_fixed_pf_inject(mut self, value: FixedPF) -> Self {
self.fixed_pf_inject = Some(value);
self
}
/// Sets the optional `fixedVar` field.
#[must_use]
pub fn with_fixed_var(mut self, value: FixedVar) -> Self {
self.fixed_var = Some(value);
self
}
/// Sets the optional `freqDroop` field.
#[must_use]
pub fn with_freq_droop(mut self, value: FreqDroop) -> Self {
self.freq_droop = Some(value);
self
}
/// Sets the optional `gradient` field.
#[must_use]
pub fn with_gradient(mut self, value: Gradient) -> Self {
self.gradient = Some(value);
self
}
/// Sets the optional `limitMaxDischarge` field.
#[must_use]
pub fn with_limit_max_discharge(mut self, value: LimitMaxDischarge) -> Self {
self.limit_max_discharge = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetDERControlRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("controlId");
validate::string(self.control_id.as_str(), None, Some(36), path, out);
path.pop();
path.push_key("controlType");
Validate::validate_at(&self.control_type, path, out);
path.pop();
path.push_key("curve");
if let Some(value) = &self.curve {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("enterService");
if let Some(value) = &self.enter_service {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("fixedPFAbsorb");
if let Some(value) = &self.fixed_pf_absorb {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("fixedPFInject");
if let Some(value) = &self.fixed_pf_inject {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("fixedVar");
if let Some(value) = &self.fixed_var {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("freqDroop");
if let Some(value) = &self.freq_droop {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("gradient");
if let Some(value) = &self.gradient {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("limitMaxDischarge");
if let Some(value) = &self.limit_max_discharge {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetDERControlRequest {}
impl Request for SetDERControlRequest {
type Action = Action;
const ACTION: Action = Action::SetDERControl;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SetDERControlResponse;
}
impl Confirmed for SetDERControlRequest {}
/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetDERControlResponse {
/// The `status` member.
pub status: DERControlStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// List of controlIds that are superseded as a result of setting this control.
#[serde(rename = "supersededIds")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub superseded_ids: Option<Vec<String>>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetDERControlResponse {
/// Creates a `SetDERControlResponse` from its required fields.
#[must_use]
pub fn new(status: DERControlStatus) -> Self {
Self {
status,
status_info: None,
superseded_ids: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `supersededIds` field.
#[must_use]
pub fn with_superseded_ids(
mut self,
value: impl IntoIterator<Item = impl Into<String>>,
) -> Self {
self.superseded_ids = Some(value.into_iter().map(Into::into).collect());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetDERControlResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("supersededIds");
if let Some(value) = &self.superseded_ids {
validate::list_len(value.len(), Some(1), Some(24), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
validate::string(item.as_str(), None, Some(36), path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetDERControlResponse {}
impl Response for SetDERControlResponse {}
/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetDefaultTariffRequest {
/// EVSE that tariff applies to. When _evseId_ = 0, then tarriff applies to all EVSEs.
#[serde(rename = "evseId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub evse_id: i32,
/// The `tariff` member.
pub tariff: Tariff,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetDefaultTariffRequest {
/// Creates a `SetDefaultTariffRequest` from its required fields.
#[must_use]
pub fn new(evse_id: i32, tariff: Tariff) -> Self {
Self {
evse_id,
tariff,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetDefaultTariffRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("evseId");
validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
path.pop();
path.push_key("tariff");
Validate::validate_at(&self.tariff, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetDefaultTariffRequest {}
impl Request for SetDefaultTariffRequest {
type Action = Action;
const ACTION: Action = Action::SetDefaultTariff;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SetDefaultTariffResponse;
}
impl Confirmed for SetDefaultTariffRequest {}
/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetDefaultTariffResponse {
/// The `status` member.
pub status: TariffSetStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetDefaultTariffResponse {
/// Creates a `SetDefaultTariffResponse` from its required fields.
#[must_use]
pub fn new(status: TariffSetStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetDefaultTariffResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetDefaultTariffResponse {}
impl Response for SetDefaultTariffResponse {}
/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetDisplayMessageRequest {
/// The `message` member.
pub message: MessageInfo,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetDisplayMessageRequest {
/// Creates a `SetDisplayMessageRequest` from its required fields.
#[must_use]
pub fn new(message: MessageInfo) -> Self {
Self {
message,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetDisplayMessageRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("message");
Validate::validate_at(&self.message, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetDisplayMessageRequest {}
impl Request for SetDisplayMessageRequest {
type Action = Action;
const ACTION: Action = Action::SetDisplayMessage;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SetDisplayMessageResponse;
}
impl Confirmed for SetDisplayMessageRequest {}
/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetDisplayMessageResponse {
/// The `status` member.
pub status: DisplayMessageStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetDisplayMessageResponse {
/// Creates a `SetDisplayMessageResponse` from its required fields.
#[must_use]
pub fn new(status: DisplayMessageStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetDisplayMessageResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetDisplayMessageResponse {}
impl Response for SetDisplayMessageResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetMonitoringBaseRequest {
/// The `monitoringBase` member.
#[serde(rename = "monitoringBase")]
pub monitoring_base: MonitoringBase,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetMonitoringBaseRequest {
/// Creates a `SetMonitoringBaseRequest` from its required fields.
#[must_use]
pub fn new(monitoring_base: MonitoringBase) -> Self {
Self {
monitoring_base,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetMonitoringBaseRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("monitoringBase");
Validate::validate_at(&self.monitoring_base, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetMonitoringBaseRequest {}
impl Request for SetMonitoringBaseRequest {
type Action = Action;
const ACTION: Action = Action::SetMonitoringBase;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SetMonitoringBaseResponse;
}
impl Confirmed for SetMonitoringBaseRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetMonitoringBaseResponse {
/// The `status` member.
pub status: GenericDeviceModelStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetMonitoringBaseResponse {
/// Creates a `SetMonitoringBaseResponse` from its required fields.
#[must_use]
pub fn new(status: GenericDeviceModelStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetMonitoringBaseResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetMonitoringBaseResponse {}
impl Response for SetMonitoringBaseResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetMonitoringLevelRequest {
/// 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.
///
/// The severity levels have the following meaning: +
/// *0-Danger* +
/// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
/// *1-Hardware Failure* +
/// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
/// *2-System Failure* +
/// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
/// *3-Critical* +
/// Indicates a critical error. Action is required. +
/// *4-Error* +
/// Indicates a non-urgent error. Action is required. +
/// *5-Alert* +
/// Indicates an alert event. Default severity for any type of monitoring event. +
/// *6-Warning* +
/// Indicates a warning event. Action may be required. +
/// *7-Notice* +
/// Indicates an unusual event. No immediate action is required. +
/// *8-Informational* +
/// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
/// *9-Debug* +
/// Indicates information useful to developers for debugging, not useful during operations.
#[serde(deserialize_with = "crate::types::integer::one")]
pub severity: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetMonitoringLevelRequest {
/// Creates a `SetMonitoringLevelRequest` from its required fields.
#[must_use]
pub fn new(severity: i32) -> Self {
Self {
severity,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetMonitoringLevelRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("severity");
validate::int_range(i64::from(self.severity), Some(0), None, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetMonitoringLevelRequest {}
impl Request for SetMonitoringLevelRequest {
type Action = Action;
const ACTION: Action = Action::SetMonitoringLevel;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SetMonitoringLevelResponse;
}
impl Confirmed for SetMonitoringLevelRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetMonitoringLevelResponse {
/// The `status` member.
pub status: GenericStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetMonitoringLevelResponse {
/// Creates a `SetMonitoringLevelResponse` from its required fields.
#[must_use]
pub fn new(status: GenericStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetMonitoringLevelResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetMonitoringLevelResponse {}
impl Response for SetMonitoringLevelResponse {}
/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetNetworkProfileRequest {
/// Slot in which the configuration should be stored.
#[serde(rename = "configurationSlot")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub configuration_slot: i32,
/// The `connectionData` member.
#[serde(rename = "connectionData")]
pub connection_data: NetworkConnectionProfile,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetNetworkProfileRequest {
/// Creates a `SetNetworkProfileRequest` from its required fields.
#[must_use]
pub fn new(configuration_slot: i32, connection_data: NetworkConnectionProfile) -> Self {
Self {
configuration_slot,
connection_data,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetNetworkProfileRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("connectionData");
Validate::validate_at(&self.connection_data, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetNetworkProfileRequest {}
impl Request for SetNetworkProfileRequest {
type Action = Action;
const ACTION: Action = Action::SetNetworkProfile;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SetNetworkProfileResponse;
}
impl Confirmed for SetNetworkProfileRequest {}
/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetNetworkProfileResponse {
/// The `status` member.
pub status: SetNetworkProfileStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetNetworkProfileResponse {
/// Creates a `SetNetworkProfileResponse` from its required fields.
#[must_use]
pub fn new(status: SetNetworkProfileStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetNetworkProfileResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetNetworkProfileResponse {}
impl Response for SetNetworkProfileResponse {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetVariableMonitoringRequest {
/// The `setMonitoringData` member.
#[serde(rename = "setMonitoringData")]
pub set_monitoring_data: Vec<SetMonitoringData>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetVariableMonitoringRequest {
/// Creates a `SetVariableMonitoringRequest` from its required fields.
#[must_use]
pub fn new(set_monitoring_data: Vec<SetMonitoringData>) -> Self {
Self {
set_monitoring_data,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetVariableMonitoringRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("setMonitoringData");
validate::list_len(self.set_monitoring_data.len(), Some(1), None, path, out);
for (index, item) in self.set_monitoring_data.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetVariableMonitoringRequest {}
impl Request for SetVariableMonitoringRequest {
type Action = Action;
const ACTION: Action = Action::SetVariableMonitoring;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SetVariableMonitoringResponse;
}
impl Confirmed for SetVariableMonitoringRequest {}
/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetVariableMonitoringResponse {
/// The `setMonitoringResult` member.
#[serde(rename = "setMonitoringResult")]
pub set_monitoring_result: Vec<SetMonitoringResult>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetVariableMonitoringResponse {
/// Creates a `SetVariableMonitoringResponse` from its required fields.
#[must_use]
pub fn new(set_monitoring_result: Vec<SetMonitoringResult>) -> Self {
Self {
set_monitoring_result,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetVariableMonitoringResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("setMonitoringResult");
validate::list_len(self.set_monitoring_result.len(), Some(1), None, path, out);
for (index, item) in self.set_monitoring_result.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetVariableMonitoringResponse {}
impl Response for SetVariableMonitoringResponse {}
/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetVariablesRequest {
/// The `setVariableData` member.
#[serde(rename = "setVariableData")]
pub set_variable_data: Vec<SetVariableData>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetVariablesRequest {
/// Creates a `SetVariablesRequest` from its required fields.
#[must_use]
pub fn new(set_variable_data: Vec<SetVariableData>) -> Self {
Self {
set_variable_data,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetVariablesRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("setVariableData");
validate::list_len(self.set_variable_data.len(), Some(1), None, path, out);
for (index, item) in self.set_variable_data.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetVariablesRequest {}
impl Request for SetVariablesRequest {
type Action = Action;
const ACTION: Action = Action::SetVariables;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = SetVariablesResponse;
}
impl Confirmed for SetVariablesRequest {}
/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SetVariablesResponse {
/// The `setVariableResult` member.
#[serde(rename = "setVariableResult")]
pub set_variable_result: Vec<SetVariableResult>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SetVariablesResponse {
/// Creates a `SetVariablesResponse` from its required fields.
#[must_use]
pub fn new(set_variable_result: Vec<SetVariableResult>) -> Self {
Self {
set_variable_result,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SetVariablesResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("setVariableResult");
validate::list_len(self.set_variable_result.len(), Some(1), None, path, out);
for (index, item) in self.set_variable_result.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SetVariablesResponse {}
impl Response for SetVariablesResponse {}
/// Spec: OCPP 2.1 · A — Security · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SignCertificateRequest {
/// 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,SignCertificateRequest>> message.
pub csr: String,
/// The `certificateType` member.
#[serde(rename = "certificateType")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub certificate_type: Option<CertificateSigningUse>,
/// The `hashRootCertificate` member.
#[serde(rename = "hashRootCertificate")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub hash_root_certificate: Option<CertificateHashData>,
/// *(2.1)* RequestId to match this message with the CertificateSignedRequest.
#[serde(rename = "requestId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub request_id: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SignCertificateRequest {
/// Creates a `SignCertificateRequest` from its required fields.
#[must_use]
pub fn new(csr: impl Into<String>) -> Self {
Self {
csr: csr.into(),
certificate_type: None,
hash_root_certificate: None,
request_id: None,
custom_data: None,
}
}
/// Sets the optional `certificateType` field.
#[must_use]
pub fn with_certificate_type(mut self, value: CertificateSigningUse) -> Self {
self.certificate_type = Some(value);
self
}
/// Sets the optional `hashRootCertificate` field.
#[must_use]
pub fn with_hash_root_certificate(mut self, value: CertificateHashData) -> Self {
self.hash_root_certificate = Some(value);
self
}
/// Sets the optional `requestId` field.
#[must_use]
pub fn with_request_id(mut self, value: i32) -> Self {
self.request_id = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SignCertificateRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("csr");
validate::string(self.csr.as_str(), None, Some(5500), path, out);
path.pop();
path.push_key("certificateType");
if let Some(value) = &self.certificate_type {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("hashRootCertificate");
if let Some(value) = &self.hash_root_certificate {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SignCertificateRequest {}
impl Request for SignCertificateRequest {
type Action = Action;
const ACTION: Action = Action::SignCertificate;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = SignCertificateResponse;
}
impl Confirmed for SignCertificateRequest {}
/// Spec: OCPP 2.1 · A — Security · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SignCertificateResponse {
/// The `status` member.
pub status: GenericStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl SignCertificateResponse {
/// Creates a `SignCertificateResponse` from its required fields.
#[must_use]
pub fn new(status: GenericStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for SignCertificateResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for SignCertificateResponse {}
impl Response for SignCertificateResponse {}
/// Spec: OCPP 2.1 · G — Availability · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct StatusNotificationRequest {
/// The time for which the status is reported.
pub timestamp: crate::types::DateTime,
/// The `connectorStatus` member.
#[serde(rename = "connectorStatus")]
pub connector_status: ConnectorStatus,
/// The id of the EVSE to which the connector belongs for which the the status is reported.
#[serde(rename = "evseId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub evse_id: i32,
/// The id of the connector within the EVSE for which the status is reported.
#[serde(rename = "connectorId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub connector_id: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl StatusNotificationRequest {
/// Creates a `StatusNotificationRequest` from its required fields.
#[must_use]
pub fn new(
timestamp: impl Into<crate::types::DateTime>,
connector_status: ConnectorStatus,
evse_id: i32,
connector_id: i32,
) -> Self {
Self {
timestamp: timestamp.into(),
connector_status,
evse_id,
connector_id,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for StatusNotificationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("connectorStatus");
Validate::validate_at(&self.connector_status, path, out);
path.pop();
path.push_key("evseId");
validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
path.pop();
path.push_key("connectorId");
validate::int_range(i64::from(self.connector_id), Some(0), None, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for StatusNotificationRequest {}
impl Request for StatusNotificationRequest {
type Action = Action;
const ACTION: Action = Action::StatusNotification;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = StatusNotificationResponse;
}
impl Confirmed for StatusNotificationRequest {}
/// Spec: OCPP 2.1 · G — Availability · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct StatusNotificationResponse {
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl StatusNotificationResponse {
/// Creates an empty `StatusNotificationResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for StatusNotificationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for StatusNotificationResponse {}
impl Response for StatusNotificationResponse {}
/// Spec: OCPP 2.1 · E — Transactions · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct TransactionEventRequest {
/// The `eventType` member.
#[serde(rename = "eventType")]
pub event_type: TransactionEventEnum,
/// The date and time at which this transaction event occurred.
pub timestamp: crate::types::DateTime,
/// The `triggerReason` member.
#[serde(rename = "triggerReason")]
pub trigger_reason: TriggerReason,
/// Incremental sequence number, helps with determining if all messages of a transaction have been received.
#[serde(rename = "seqNo")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub seq_no: i32,
/// The `transactionInfo` member.
#[serde(rename = "transactionInfo")]
pub transaction_info: Transaction,
/// The `costDetails` member.
#[serde(rename = "costDetails")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cost_details: Option<CostDetails>,
/// The `meterValue` member.
#[serde(rename = "meterValue")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub meter_value: Option<Vec<MeterValue>>,
/// Indication that this transaction event happened when the Charging Station was offline. Default = false, meaning: the event occurred when the Charging Station was online.
/// Schema default: `false`.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub offline: Option<bool>,
/// 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 as follows: +
/// 1: The numberPhases in the currently used ChargingSchedule. +
/// 2: The number of phases provided via device management.
#[serde(rename = "numberOfPhasesUsed")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub number_of_phases_used: Option<i32>,
/// The maximum current of the connected cable in Ampere (A).
#[serde(rename = "cableMaxCurrent")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub cable_max_current: Option<i32>,
/// This contains the Id of the reservation that terminates as a result of this transaction.
#[serde(rename = "reservationId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub reservation_id: Option<i32>,
/// The `preconditioningStatus` member.
#[serde(rename = "preconditioningStatus")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub preconditioning_status: Option<PreconditioningStatus>,
/// *(2.1)* True when EVSE electronics are in sleep mode for this transaction. Default value (when absent) is false.
#[serde(rename = "evseSleep")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub evse_sleep: Option<bool>,
/// The `evse` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub evse: Option<EVSE>,
/// The `idToken` member.
#[serde(rename = "idToken")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id_token: Option<IdToken>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl TransactionEventRequest {
/// Creates a `TransactionEventRequest` from its required fields.
#[must_use]
pub fn new(
event_type: TransactionEventEnum,
timestamp: impl Into<crate::types::DateTime>,
trigger_reason: TriggerReason,
seq_no: i32,
transaction_info: Transaction,
) -> Self {
Self {
event_type,
timestamp: timestamp.into(),
trigger_reason,
seq_no,
transaction_info,
cost_details: None,
meter_value: None,
offline: None,
number_of_phases_used: None,
cable_max_current: None,
reservation_id: None,
preconditioning_status: None,
evse_sleep: None,
evse: None,
id_token: None,
custom_data: None,
}
}
/// Sets the optional `costDetails` field.
#[must_use]
pub fn with_cost_details(mut self, value: CostDetails) -> Self {
self.cost_details = Some(value);
self
}
/// Sets the optional `meterValue` field.
#[must_use]
pub fn with_meter_value(mut self, value: Vec<MeterValue>) -> Self {
self.meter_value = Some(value);
self
}
/// Sets the optional `offline` field.
#[must_use]
pub fn with_offline(mut self, value: bool) -> Self {
self.offline = Some(value);
self
}
/// Sets the optional `numberOfPhasesUsed` field.
#[must_use]
pub fn with_number_of_phases_used(mut self, value: i32) -> Self {
self.number_of_phases_used = Some(value);
self
}
/// Sets the optional `cableMaxCurrent` field.
#[must_use]
pub fn with_cable_max_current(mut self, value: i32) -> Self {
self.cable_max_current = Some(value);
self
}
/// Sets the optional `reservationId` field.
#[must_use]
pub fn with_reservation_id(mut self, value: i32) -> Self {
self.reservation_id = Some(value);
self
}
/// Sets the optional `preconditioningStatus` field.
#[must_use]
pub fn with_preconditioning_status(mut self, value: PreconditioningStatus) -> Self {
self.preconditioning_status = Some(value);
self
}
/// Sets the optional `evseSleep` field.
#[must_use]
pub fn with_evse_sleep(mut self, value: bool) -> Self {
self.evse_sleep = Some(value);
self
}
/// Sets the optional `evse` field.
#[must_use]
pub fn with_evse(mut self, value: EVSE) -> Self {
self.evse = Some(value);
self
}
/// Sets the optional `idToken` field.
#[must_use]
pub fn with_id_token(mut self, value: IdToken) -> Self {
self.id_token = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for TransactionEventRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("eventType");
Validate::validate_at(&self.event_type, path, out);
path.pop();
path.push_key("triggerReason");
Validate::validate_at(&self.trigger_reason, path, out);
path.pop();
path.push_key("seqNo");
validate::int_range(i64::from(self.seq_no), Some(0), None, path, out);
path.pop();
path.push_key("transactionInfo");
Validate::validate_at(&self.transaction_info, path, out);
path.pop();
path.push_key("costDetails");
if let Some(value) = &self.cost_details {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("meterValue");
if let Some(value) = &self.meter_value {
validate::list_len(value.len(), Some(1), None, path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("numberOfPhasesUsed");
if let Some(value) = &self.number_of_phases_used {
validate::int_range(i64::from(*value), Some(0), Some(3), path, out);
}
path.pop();
path.push_key("reservationId");
if let Some(value) = &self.reservation_id {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("preconditioningStatus");
if let Some(value) = &self.preconditioning_status {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("evse");
if let Some(value) = &self.evse {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("idToken");
if let Some(value) = &self.id_token {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for TransactionEventRequest {}
impl Request for TransactionEventRequest {
type Action = Action;
const ACTION: Action = Action::TransactionEvent;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = TransactionEventResponse;
}
impl Confirmed for TransactionEventRequest {}
/// Spec: OCPP 2.1 · E — Transactions · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct TransactionEventResponse {
/// When _eventType_ of TransactionEventRequest is Updated, then this value contains the running cost. When _eventType_ of TransactionEventRequest is Ended, then this contains the final total cost of this transaction, including taxes, in the currency configured with the Configuration Variable: Currency. Absence of this value does not imply that the transaction was free. To indicate a free transaction, the CSMS SHALL send a value of 0.00.
#[serde(rename = "totalCost")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub total_cost: Option<crate::types::Decimal>,
/// 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,TransactionEventResponse>> is temporarily, so it may not be set in the <<cmn_idtokeninfotype,IdTokenInfoType>> afterwards. Also the chargingPriority in <<transactioneventresponse,TransactionEventResponse>> has a higher priority than the one in <<cmn_idtokeninfotype,IdTokenInfoType>>.
#[serde(rename = "chargingPriority")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub charging_priority: Option<i32>,
/// The `idTokenInfo` member.
#[serde(rename = "idTokenInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id_token_info: Option<IdTokenInfo>,
/// The `transactionLimit` member.
#[serde(rename = "transactionLimit")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub transaction_limit: Option<TransactionLimit>,
/// The `updatedPersonalMessage` member.
#[serde(rename = "updatedPersonalMessage")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub updated_personal_message: Option<MessageContent>,
/// The `updatedPersonalMessageExtra` member.
#[serde(rename = "updatedPersonalMessageExtra")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub updated_personal_message_extra: Option<Vec<MessageContent>>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl TransactionEventResponse {
/// Creates an empty `TransactionEventResponse`. Every field of this type is optional.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the optional `totalCost` field.
#[must_use]
pub fn with_total_cost(mut self, value: impl Into<crate::types::Decimal>) -> Self {
self.total_cost = Some(value.into());
self
}
/// Sets the optional `chargingPriority` field.
#[must_use]
pub fn with_charging_priority(mut self, value: i32) -> Self {
self.charging_priority = Some(value);
self
}
/// Sets the optional `idTokenInfo` field.
#[must_use]
pub fn with_id_token_info(mut self, value: IdTokenInfo) -> Self {
self.id_token_info = Some(value);
self
}
/// Sets the optional `transactionLimit` field.
#[must_use]
pub fn with_transaction_limit(mut self, value: TransactionLimit) -> Self {
self.transaction_limit = Some(value);
self
}
/// Sets the optional `updatedPersonalMessage` field.
#[must_use]
pub fn with_updated_personal_message(mut self, value: MessageContent) -> Self {
self.updated_personal_message = Some(value);
self
}
/// Sets the optional `updatedPersonalMessageExtra` field.
#[must_use]
pub fn with_updated_personal_message_extra(mut self, value: Vec<MessageContent>) -> Self {
self.updated_personal_message_extra = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for TransactionEventResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("idTokenInfo");
if let Some(value) = &self.id_token_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("transactionLimit");
if let Some(value) = &self.transaction_limit {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("updatedPersonalMessage");
if let Some(value) = &self.updated_personal_message {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("updatedPersonalMessageExtra");
if let Some(value) = &self.updated_personal_message_extra {
validate::list_len(value.len(), Some(1), Some(4), path, out);
for (index, item) in value.iter().enumerate() {
path.push_index(index);
Validate::validate_at(item, path, out);
path.pop();
}
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for TransactionEventResponse {}
impl Response for TransactionEventResponse {}
/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct TriggerMessageRequest {
/// The `requestedMessage` member.
#[serde(rename = "requestedMessage")]
pub requested_message: MessageTrigger,
/// The `evse` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub evse: Option<EVSE>,
/// *(2.1)* When _requestedMessage_ = `CustomTrigger` this will trigger sending the corresponding message in field _customTrigger_, if supported by Charging Station.
#[serde(rename = "customTrigger")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_trigger: Option<String>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl TriggerMessageRequest {
/// Creates a `TriggerMessageRequest` from its required fields.
#[must_use]
pub fn new(requested_message: MessageTrigger) -> Self {
Self {
requested_message,
evse: None,
custom_trigger: None,
custom_data: None,
}
}
/// Sets the optional `evse` field.
#[must_use]
pub fn with_evse(mut self, value: EVSE) -> Self {
self.evse = Some(value);
self
}
/// Sets the optional `customTrigger` field.
#[must_use]
pub fn with_custom_trigger(mut self, value: impl Into<String>) -> Self {
self.custom_trigger = Some(value.into());
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for TriggerMessageRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("requestedMessage");
Validate::validate_at(&self.requested_message, path, out);
path.pop();
path.push_key("evse");
if let Some(value) = &self.evse {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customTrigger");
if let Some(value) = &self.custom_trigger {
validate::string(value.as_str(), None, Some(50), path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for TriggerMessageRequest {}
impl Request for TriggerMessageRequest {
type Action = Action;
const ACTION: Action = Action::TriggerMessage;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = TriggerMessageResponse;
}
impl Confirmed for TriggerMessageRequest {}
/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct TriggerMessageResponse {
/// The `status` member.
pub status: TriggerMessageStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl TriggerMessageResponse {
/// Creates a `TriggerMessageResponse` from its required fields.
#[must_use]
pub fn new(status: TriggerMessageStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for TriggerMessageResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for TriggerMessageResponse {}
impl Response for TriggerMessageResponse {}
/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UnlockConnectorRequest {
/// This contains the identifier of the EVSE for which a connector needs to be unlocked.
#[serde(rename = "evseId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub evse_id: i32,
/// This contains the identifier of the connector that needs to be unlocked.
#[serde(rename = "connectorId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub connector_id: i32,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl UnlockConnectorRequest {
/// Creates a `UnlockConnectorRequest` from its required fields.
#[must_use]
pub fn new(evse_id: i32, connector_id: i32) -> Self {
Self {
evse_id,
connector_id,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for UnlockConnectorRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("evseId");
validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
path.pop();
path.push_key("connectorId");
validate::int_range(i64::from(self.connector_id), Some(0), None, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for UnlockConnectorRequest {}
impl Request for UnlockConnectorRequest {
type Action = Action;
const ACTION: Action = Action::UnlockConnector;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = UnlockConnectorResponse;
}
impl Confirmed for UnlockConnectorRequest {}
/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UnlockConnectorResponse {
/// The `status` member.
pub status: UnlockStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl UnlockConnectorResponse {
/// Creates a `UnlockConnectorResponse` from its required fields.
#[must_use]
pub fn new(status: UnlockStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for UnlockConnectorResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for UnlockConnectorResponse {}
impl Response for UnlockConnectorResponse {}
/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UnpublishFirmwareRequest {
/// The MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
pub checksum: String,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl UnpublishFirmwareRequest {
/// Creates a `UnpublishFirmwareRequest` from its required fields.
#[must_use]
pub fn new(checksum: impl Into<String>) -> Self {
Self {
checksum: checksum.into(),
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for UnpublishFirmwareRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("checksum");
validate::string(self.checksum.as_str(), None, Some(32), path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for UnpublishFirmwareRequest {}
impl Request for UnpublishFirmwareRequest {
type Action = Action;
const ACTION: Action = Action::UnpublishFirmware;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = UnpublishFirmwareResponse;
}
impl Confirmed for UnpublishFirmwareRequest {}
/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UnpublishFirmwareResponse {
/// The `status` member.
pub status: UnpublishFirmwareStatus,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl UnpublishFirmwareResponse {
/// Creates a `UnpublishFirmwareResponse` from its required fields.
#[must_use]
pub fn new(status: UnpublishFirmwareStatus) -> Self {
Self {
status,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for UnpublishFirmwareResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for UnpublishFirmwareResponse {}
impl Response for UnpublishFirmwareResponse {}
/// Id of dynamic charging profile to update.
///
/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateDynamicScheduleRequest {
/// Id of charging profile to update.
#[serde(rename = "chargingProfileId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub charging_profile_id: i32,
/// The `scheduleUpdate` member.
#[serde(rename = "scheduleUpdate")]
pub schedule_update: ChargingScheduleUpdate,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl UpdateDynamicScheduleRequest {
/// Creates a `UpdateDynamicScheduleRequest` from its required fields.
#[must_use]
pub fn new(charging_profile_id: i32, schedule_update: ChargingScheduleUpdate) -> Self {
Self {
charging_profile_id,
schedule_update,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for UpdateDynamicScheduleRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("scheduleUpdate");
Validate::validate_at(&self.schedule_update, path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for UpdateDynamicScheduleRequest {}
impl Request for UpdateDynamicScheduleRequest {
type Action = Action;
const ACTION: Action = Action::UpdateDynamicSchedule;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = UpdateDynamicScheduleResponse;
}
impl Confirmed for UpdateDynamicScheduleRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateDynamicScheduleResponse {
/// The `status` member.
pub status: ChargingProfileStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl UpdateDynamicScheduleResponse {
/// Creates a `UpdateDynamicScheduleResponse` from its required fields.
#[must_use]
pub fn new(status: ChargingProfileStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for UpdateDynamicScheduleResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for UpdateDynamicScheduleResponse {}
impl Response for UpdateDynamicScheduleResponse {}
/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateFirmwareRequest {
/// The Id of this request
#[serde(rename = "requestId")]
#[serde(deserialize_with = "crate::types::integer::one")]
pub request_id: i32,
/// The `firmware` member.
pub firmware: Firmware,
/// This specifies how many times Charging Station must retry 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.
/// If the value is 0, it means: no retries.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub retries: Option<i32>,
/// 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.
#[serde(rename = "retryInterval")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub retry_interval: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl UpdateFirmwareRequest {
/// Creates a `UpdateFirmwareRequest` from its required fields.
#[must_use]
pub fn new(request_id: i32, firmware: Firmware) -> Self {
Self {
request_id,
firmware,
retries: None,
retry_interval: None,
custom_data: None,
}
}
/// Sets the optional `retries` field.
#[must_use]
pub fn with_retries(mut self, value: i32) -> Self {
self.retries = Some(value);
self
}
/// Sets the optional `retryInterval` field.
#[must_use]
pub fn with_retry_interval(mut self, value: i32) -> Self {
self.retry_interval = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for UpdateFirmwareRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("firmware");
Validate::validate_at(&self.firmware, path, out);
path.pop();
path.push_key("retries");
if let Some(value) = &self.retries {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for UpdateFirmwareRequest {}
impl Request for UpdateFirmwareRequest {
type Action = Action;
const ACTION: Action = Action::UpdateFirmware;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = UpdateFirmwareResponse;
}
impl Confirmed for UpdateFirmwareRequest {}
/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateFirmwareResponse {
/// The `status` member.
pub status: UpdateFirmwareStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl UpdateFirmwareResponse {
/// Creates a `UpdateFirmwareResponse` from its required fields.
#[must_use]
pub fn new(status: UpdateFirmwareStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for UpdateFirmwareResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for UpdateFirmwareResponse {}
impl Response for UpdateFirmwareResponse {}
/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UsePriorityChargingRequest {
/// The transaction for which priority charging is requested.
#[serde(rename = "transactionId")]
pub transaction_id: String,
/// True to request priority charging.
/// False to request stopping priority charging.
pub activate: bool,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl UsePriorityChargingRequest {
/// Creates a `UsePriorityChargingRequest` from its required fields.
#[must_use]
pub fn new(transaction_id: impl Into<String>, activate: bool) -> Self {
Self {
transaction_id: transaction_id.into(),
activate,
custom_data: None,
}
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for UsePriorityChargingRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("transactionId");
validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for UsePriorityChargingRequest {}
impl Request for UsePriorityChargingRequest {
type Action = Action;
const ACTION: Action = Action::UsePriorityCharging;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::Csms;
type Response = UsePriorityChargingResponse;
}
impl Confirmed for UsePriorityChargingRequest {}
/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UsePriorityChargingResponse {
/// The `status` member.
pub status: PriorityChargingStatus,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl UsePriorityChargingResponse {
/// Creates a `UsePriorityChargingResponse` from its required fields.
#[must_use]
pub fn new(status: PriorityChargingStatus) -> Self {
Self {
status,
status_info: None,
custom_data: None,
}
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for UsePriorityChargingResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for UsePriorityChargingResponse {}
impl Response for UsePriorityChargingResponse {}
/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct VatNumberValidationRequest {
/// VAT number to check.
#[serde(rename = "vatNumber")]
pub vat_number: String,
/// EVSE id for which check is done
#[serde(rename = "evseId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub evse_id: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl VatNumberValidationRequest {
/// Creates a `VatNumberValidationRequest` from its required fields.
#[must_use]
pub fn new(vat_number: impl Into<String>) -> Self {
Self {
vat_number: vat_number.into(),
evse_id: None,
custom_data: None,
}
}
/// Sets the optional `evseId` field.
#[must_use]
pub fn with_evse_id(mut self, value: i32) -> Self {
self.evse_id = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for VatNumberValidationRequest {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("vatNumber");
validate::string(self.vat_number.as_str(), None, Some(20), path, out);
path.pop();
path.push_key("evseId");
if let Some(value) = &self.evse_id {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for VatNumberValidationRequest {}
impl Request for VatNumberValidationRequest {
type Action = Action;
const ACTION: Action = Action::VatNumberValidation;
const KIND: MessageKind = MessageKind::Call;
const ORIGIN: Origin = Origin::ChargingStation;
type Response = VatNumberValidationResponse;
}
impl Confirmed for VatNumberValidationRequest {}
/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct VatNumberValidationResponse {
/// VAT number that was requested.
#[serde(rename = "vatNumber")]
pub vat_number: String,
/// The `status` member.
pub status: GenericStatus,
/// The `company` member.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub company: Option<Address>,
/// The `statusInfo` member.
#[serde(rename = "statusInfo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status_info: Option<StatusInfo>,
/// EVSE id for which check was requested.
#[serde(rename = "evseId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "crate::types::integer::option")]
pub evse_id: Option<i32>,
/// The `customData` member.
#[serde(rename = "customData")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_data: Option<crate::types::CustomData>,
}
impl VatNumberValidationResponse {
/// Creates a `VatNumberValidationResponse` from its required fields.
#[must_use]
pub fn new(vat_number: impl Into<String>, status: GenericStatus) -> Self {
Self {
vat_number: vat_number.into(),
status,
company: None,
status_info: None,
evse_id: None,
custom_data: None,
}
}
/// Sets the optional `company` field.
#[must_use]
pub fn with_company(mut self, value: Address) -> Self {
self.company = Some(value);
self
}
/// Sets the optional `statusInfo` field.
#[must_use]
pub fn with_status_info(mut self, value: StatusInfo) -> Self {
self.status_info = Some(value);
self
}
/// Sets the optional `evseId` field.
#[must_use]
pub fn with_evse_id(mut self, value: i32) -> Self {
self.evse_id = Some(value);
self
}
/// Sets the optional `customData` field.
#[must_use]
pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
self.custom_data = Some(value);
self
}
}
impl Validate for VatNumberValidationResponse {
fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
path.push_key("vatNumber");
validate::string(self.vat_number.as_str(), None, Some(20), path, out);
path.pop();
path.push_key("status");
Validate::validate_at(&self.status, path, out);
path.pop();
path.push_key("company");
if let Some(value) = &self.company {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("statusInfo");
if let Some(value) = &self.status_info {
Validate::validate_at(value, path, out);
}
path.pop();
path.push_key("evseId");
if let Some(value) = &self.evse_id {
validate::int_range(i64::from(*value), Some(0), None, path, out);
}
path.pop();
path.push_key("customData");
if let Some(value) = &self.custom_data {
Validate::validate_at(value, path, out);
}
path.pop();
}
}
impl Sealed for VatNumberValidationResponse {}
impl Response for VatNumberValidationResponse {}