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    #[serde(skip_serializing_if = "Option::is_none")]
17    pub data: Option<String>,
18    /// This identifies the Vendor specific     implementation
19    #[validate(length(min = 0, max = 255))]
20    pub vendor_id: String,
21}
22
23/// 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.
24#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Default)]
25#[serde(rename_all = "camelCase")]
26pub struct DataTransferResponse {
27    /// This indicates the success or failure of the data transfer.
28    pub status: DataTransferStatusEnumType,
29    /// Data without specified length or format, in response to request.
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub data: Option<String>,
32    /// Detailed status information.
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub status_info: Option<StatusInfoType>,
35}