rust_ocpp/v1_6/messages/status_notification.rs
1use crate::v1_6::types::{ChargePointErrorCode, ChargePointStatus};
2
3use chrono::{DateTime, Utc};
4use validator::Validate;
5
6/// This contains the field definition of the StatusNotification.req PDU sent by the Charge Point to the Central System. See also Status Notification
7#[derive(serde::Serialize, serde::Deserialize, Validate, Debug, Clone, PartialEq, Default)]
8#[serde(rename_all = "camelCase")]
9pub struct StatusNotificationRequest {
10 /// Required. The id of the connector for which the status is reported. Id '0' (zero) is used if the status is for the Charge Point main controller.
11 pub connector_id: u32,
12 /// Required. This contains the error code reported by the Charge Point.
13 pub error_code: ChargePointErrorCode, // IdToken, should this be a type?
14 /// Optional. Additional free format information related to the error.
15 #[serde(skip_serializing_if = "Option::is_none")]
16 #[validate(length(min = 1, max = 50))]
17 pub info: Option<String>,
18 /// Required. This contains the current status of the Charge Point.
19 pub status: ChargePointStatus,
20 /// Optional. The time for which the status is reported. If absent time of receipt of the message will be assumed.
21 #[serde(skip_serializing_if = "Option::is_none")]
22 pub timestamp: Option<DateTime<Utc>>,
23 /// Optional. This identifies the vendor-specific implementation.
24 #[serde(skip_serializing_if = "Option::is_none")]
25 #[validate(length(min = 1, max = 255))]
26 pub vendor_id: Option<String>,
27 /// Optional. This contains the vendor-specific error code.
28 #[serde(skip_serializing_if = "Option::is_none")]
29 #[validate(length(min = 1, max = 50))]
30 pub vendor_error_code: Option<String>,
31}
32
33/// This contains the field definition of the StartTransaction.conf PDU sent by the Central System to the Charge Point in response to a StartTransaction.req PDU. See also Start Transaction
34#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Default)]
35#[serde(rename_all = "camelCase")]
36pub struct StatusNotificationResponse {
37 // This contains the field definition of the StatusNotification.conf PDU sent by the Central System to the Charge Point in response to an StatusNotification.req PDU. See also Status Notification No fields are defined.
38}