1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use validator::Validate;
use crate::v2_1::{
datatypes::{ComponentType, CustomDataType, MessageContentType},
enumerations::{MessagePriorityEnumType, MessageStateEnumType},
};
/// Contains message details, for a message to be displayed on a Charging Station.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Validate)]
#[serde(rename_all = "camelCase")]
pub struct MessageInfoType {
/// Optional. Display component that this message concerns.
#[serde(skip_serializing_if = "Option::is_none")]
pub display: Option<ComponentType>,
/// Required. Unique id within an exchange context. It is defined within the OCPP context as a positive Integer value (greater or equal to zero).
#[validate(range(min = 0))]
pub id: i32,
/// Required. With what priority should this message be shown.
pub priority: MessagePriorityEnumType,
/// Optional. During what state should this message be shown.
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<MessageStateEnumType>,
/// Optional. From what date-time should this message be shown. If omitted: directly.
#[serde(skip_serializing_if = "Option::is_none")]
pub start_date_time: Option<DateTime<Utc>>,
/// Optional. Until what date-time should this message be shown, after this date/time this message SHALL be removed.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date_time: Option<DateTime<Utc>>,
/// Optional. During which transaction shall this message be shown.
/// Message SHALL be removed by the Charging Station after transaction has ended.
#[serde(skip_serializing_if = "Option::is_none")]
#[validate(length(max = 36))]
pub transaction_id: Option<String>,
/// Required. Contains message details.
pub message: MessageContentType,
/// Optional. Custom data specific to this class.
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_data: Option<CustomDataType>,
}
/// Request to notify the CSMS about display messages.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Validate)]
#[serde(rename_all = "camelCase")]
pub struct NotifyDisplayMessagesRequest {
/// Required. Id of this request for identification in response.
#[validate(range(min = 0))]
pub request_id: i32,
/// Optional. "to be continued" indicator. Indicates whether another part of the report follows in an upcoming notifyDisplayMessagesRequest message. Default value when omitted is false.
#[serde(skip_serializing_if = "Option::is_none")]
pub tbc: Option<bool>,
/// Required. Array of message info objects.
#[validate(length(min = 1))]
pub message_info: Vec<MessageInfoType>,
/// Optional. Custom data specific to this class.
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_data: Option<CustomDataType>,
}
/// Response to a NotifyDisplayMessagesRequest. This message has no fields.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Validate)]
#[serde(rename_all = "camelCase")]
pub struct NotifyDisplayMessagesResponse {
/// Optional. Custom data specific to this class.
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_data: Option<CustomDataType>,
}