rust_ocpp/v1_6/messages/boot_notification.rs
1//! # From OCPP Specification
2//! 4.2. Boot Notification
3//! After start-up, a Charge Point SHALL send a request to the Central System with information
4//! about its configuration (e.g. version, vendor, etc.). The Central System SHALL respond to
5//! indicate whether it will accept the Charge Point.
6//!
7//! The Charge Point SHALL send a BootNotification.req PDU each time it boots or reboots. Between
8//! the physical power-on/reboot and the successful completion of a BootNotification, where Central
9//! System returns Accepted or Pending, the Charge Point SHALL NOT send any other request to the
10//! Central System. This includes cached messages that are still present in the Charge Point from
11//! before.
12//!
13//! When the Central System responds with a BootNotification.conf with a status Accepted, the
14//! Charge Point will adjust the heartbeat interval in accordance with the interval from the
15//! response PDU and it is RECOMMENDED to synchronize its internal clock with the supplied Central
16//! System’s current time. If the Central System returns something other than Accepted, the value
17//! of the interval field indicates the minimum wait time before sending a next BootNotification
18//! request. If that interval value is zero, the Charge Point chooses a waiting interval on its
19//! own, in a way that avoids flooding the Central System with requests. A Charge Point SHOULD NOT
20//! send a BootNotification.req earlier, unless requested to do so with a TriggerMessage.req.
21//! If the Central System returns the status Rejected, the Charge Point SHALL NOT send any OCPP
22//! message to the Central System until the aforementioned retry interval has expired. During this
23//! interval the Charge Point may no longer be reachable from the Central System. It MAY for
24//! instance close its communication channel or shut down its communication hardware. Also the
25//! Central System MAY close the communication channel, for instance to free up system resources.
26//! While Rejected, the Charge Point SHALL NOT respond to any Central System initiated message. the
27//! Central System SHOULD NOT initiate any.
28//!
29//! The Central System MAY also return a Pending registration status to indicate that it wants to
30//! retrieve or set certain information on the Charge Point before the Central System will accept
31//! the Charge Point. If the Central System returns the Pending status, the communication channel
32//! SHOULD NOT be closed by either the Charge Point or the Central System. The Central System MAY
33//! send request messages to retrieve information from the Charge Point or change its configuration.
34//! The Charge Point SHOULD respond to these messages. The Charge Point SHALL NOT send request
35//! messages to the Central System unless it has been instructed by the Central System to do so
36//! with a TriggerMessage.req request.
37//!
38//! While in pending state, the following Central System initiated messages are not allowed:
39//! RemoteStartTransaction.req and RemoteStopTransaction.req
40
41use crate::v1_6::types::RegistrationStatus;
42use chrono::{DateTime, Utc};
43use validator::Validate;
44
45#[derive(serde::Serialize, serde::Deserialize, Validate, Debug, Clone, PartialEq, Default)]
46#[serde(rename_all = "camelCase")]
47pub struct BootNotificationRequest {
48 /// # From OCPP Specification
49 /// Optional. This contains a value that identifies the serial number of the Charge Box inside
50 /// the Charge Point. Deprecated, will be removed in future version
51 #[validate(length(min = 1, max = 25))]
52 #[serde(skip_serializing_if = "Option::is_none")]
53 pub charge_box_serial_number: Option<String>,
54
55 /// # From OCPP Specification
56 /// Required. This contains a value that identifies the model of the ChargePoint.
57 #[validate(length(min = 1, max = 20))]
58 pub charge_point_model: String,
59
60 /// # From OCPP Specification
61 /// Optional. This contains a value that identifies the serial number of the Charge Point.
62 #[validate(length(min = 1, max = 25))]
63 #[serde(skip_serializing_if = "Option::is_none")]
64 pub charge_point_serial_number: Option<String>,
65
66 /// # From OCPP Specification
67 /// Required. This contains a value that identifies the vendor of the ChargePoint.
68 #[validate(length(min = 1, max = 20))]
69 pub charge_point_vendor: String,
70
71 /// # From OCPP Specification
72 /// Optional. This contains the firmware version of the Charge Point.
73 #[validate(length(min = 1, max = 50))]
74 #[serde(skip_serializing_if = "Option::is_none")]
75 pub firmware_version: Option<String>,
76
77 /// # From OCPP Specification
78 /// Optional. This contains the ICCID of the modem’s SIM card.
79 #[validate(length(min = 1, max = 20))]
80 #[serde(skip_serializing_if = "Option::is_none")]
81 pub iccid: Option<String>,
82
83 /// # From OCPP Specification
84 /// Optional. This contains the IMSI of the modem’s SIM card.
85 #[validate(length(min = 1, max = 20))]
86 #[serde(skip_serializing_if = "Option::is_none")]
87 pub imsi: Option<String>,
88
89 /// # From OCPP Specification
90 /// Optional. This contains the serial number of the main electrical meter of the Charge Point.
91 #[serde(skip_serializing_if = "Option::is_none")]
92 #[validate(length(min = 1, max = 25))]
93 pub meter_serial_number: Option<String>,
94
95 /// # From OCPP Specification
96 /// Optional. This contains the type of the main electrical meter of the Charge Point.
97 #[serde(skip_serializing_if = "Option::is_none")]
98 #[validate(length(min = 1, max = 25))]
99 pub meter_type: Option<String>,
100}
101
102#[derive(serde::Serialize, serde::Deserialize, Validate, Debug, Clone, PartialEq, Default)]
103#[serde(rename_all = "camelCase")]
104pub struct BootNotificationResponse {
105 /// # From OCPP Specification
106 /// Required. This contains the Central System’s current time.
107 pub current_time: DateTime<Utc>,
108
109 /// # From OCPP Specification
110 /// Required. When RegistrationStatus is Accepted, this contains the heartbeat interval in
111 /// seconds. If the Central System returns something other than Accepted, the value of the
112 /// interval field indicates the minimum wait time before sending a next BootNotification
113 /// request.
114 pub interval: u32,
115
116 /// # From OCPP Specification
117 /// Required. This contains whether the Charge Point has been registered within the System
118 /// Central.
119 pub status: RegistrationStatus,
120}