rust_ocpp/v2_0_1/messages/
datatransfer.rs

1//! DataTransfer
2use validator::Validate;
3
4use crate::v2_0_1::datatypes::status_info_type::StatusInfoType;
5use crate::v2_0_1::enumerations::data_transfer_status_enum_type::DataTransferStatusEnumType;
6
7/// DataTransferRequest, sent either by the CSMS to the Charging Station or vice versa.
8#[derive(serde::Serialize, serde::Deserialize, Validate, Debug, Clone, PartialEq, Default)]
9#[serde(rename_all = "camelCase")]
10pub struct DataTransferRequest {
11    /// May be used to indicate a specific message or implementation.
12    #[validate(length(min = 0, max = 50))]
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub message_id: Option<String>,
15    /// Data without specified length or format. This needs to be decided by both parties (Open to implementation).
16    pub data: String,
17    /// This identifies the Vendor specific     implementation
18    #[validate(length(min = 0, max = 255))]
19    pub vendor_id: String,
20}
21
22/// This contains the field definition of the DataTransferResponse PDU sent by the Charging Station to the CSMS or vice versa in response to a DataTransferRequest.
23#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Default)]
24#[serde(rename_all = "camelCase")]
25pub struct DataTransferResponse {
26    /// This indicates the success or failure of the data transfer.
27    pub status: DataTransferStatusEnumType,
28    /// Data without specified length or format, in response to request.
29    pub data: String,
30    /// Detailed status information.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub status_info: Option<StatusInfoType>,
33}