Standard catalogues
OCPP 2.1's security events with their criticality, 74 standardized components with 458 variables, and the standardized reason codes — extracted from Part 2 Appendices.
The JSON schemas define the messages. They do not define the vocabulary those messages talk about: which security events exist and which of them are critical, what the device model's components and variables are called, or what a statusInfo.reasonCode may say. That lives in OCPP 2.1 Part 2 — Appendices, a PDF.
ocpp_kit::standard reproduces the interoperability surface of that appendix — names, data types and criticality — so it can be used and checked in code rather than transcribed by hand each time. The prose descriptions are not reproduced; read them in the appendix.
Security events
use ocpp_kit::standard::SecurityEvent;
// 21 events, exactly as the appendix lists them.
assert_eq!(SecurityEvent::VARIANTS.len(), 21);
// An implemented event is written to the security log; an implemented event marked
// *critical* is additionally pushed to the CSMS with SecurityEventNotification.
assert!(SecurityEvent::TamperDetectionActivated.is_critical());
assert!(SecurityEvent::InvalidCsmsCertificate.is_critical());
assert!(!SecurityEvent::InvalidMessages.is_critical());
// The list is explicitly non-exhaustive, and a vendor event is treated as critical —
// reporting something unrecognised is the safe direction to err in.
let vendor = SecurityEvent::from_wire("AcmeCabinetOpened");
assert!(!vendor.is_known());
assert!(vendor.is_critical());Deciding which events a station implements is the application's business. Knowing which of them are critical is not, and getting it wrong means either spamming the CSMS or silently swallowing a tamper alarm.
1.6 has its own list, from the Security Whitepaper (edition 4, §8), with its own names and its own verdicts — InvalidFirmwareSignature is critical in 2.x and not in 1.6:
use ocpp_kit::standard::{SecurityEvent, security_events_1_6};
assert!(SecurityEvent::InvalidFirmwareSignature.is_critical());
assert!(!security_events_1_6::SecurityEvent::InvalidFirmwareSignature.is_critical());
assert!(!security_events_1_6::SecurityEvent::FailedToAuthenticateAtCentralSystem.is_critical());Components and variables
74 standardized components and 458 variables, with the data type and unit filled in from the appendix's own tables.
use ocpp_kit::standard::components;
let comm = components::component("OCPPCommCtrlr").expect("a standard component");
assert!(comm.variables.iter().any(|v| v.name == "RetryBackOffWaitMinimum"));
let heartbeat = components::variable("OCPPCommCtrlr", "HeartbeatInterval").unwrap();
assert_eq!(heartbeat.data_type, Some("integer"));
assert_eq!(heartbeat.unit, Some("s"));
// `Count[ChargingProfiles]` is a variable *instance*, not a name.
let evse = components::component("EVSE").unwrap();
let count = evse.variables.iter().find(|v| v.name == "Count").unwrap();
assert_eq!(count.instance, Some("ChargingProfiles"));The device model takes what it needs from here, so a station gets the names, types and units right without restating them:
use ocpp_kit::station::device_model::{DataType, DeviceModel, ReportBase};
let mut model = DeviceModel::new();
model.declare_standard("OCPPCommCtrlr").expect("a standard component");
let report = model.report(ReportBase::FullInventory, Some("OCPPCommCtrlr"), Some("HeartbeatInterval"));
assert_eq!(report[0].data_type, DataType::Integer);
assert_eq!(report[0].unit.as_deref(), Some("s"));The appendix's list is a vocabulary, not a requirement: a station implements the part of it it actually has. declare_standard is a starting point, not a claim.
Reason codes
use ocpp_kit::standard::ReasonCode;
assert_eq!(ReasonCode::InvalidProfile.as_str(), "InvalidProfile");
// Open, like every other OCPP enumeration.
assert!(!ReasonCode::from_wire("AcmeSpecific").is_known());statusInfo is optional and every message carries a status of its own, so a reason code adds insight rather than meaning — but using the standardized spelling is what lets the other side act on it automatically.
Where they come from
The appendix is OCA-licensed material this repository does not redistribute. What is committed is the extracted vocabulary, generated by cargo xtask appendix from a text rendering of the PDF:
$ pdftotext -layout OCPP-2.1_edition2_part2_appendices_v21.pdf appendices.txt
$ OCPP_APPENDIX=appendices.txt OCPP_WHITEPAPER_1_6=whitepaper.txt cargo xtask appendix
parsed 21 security events, 74 components (458 variables), 216 standardized variables, 62 reason codes, 34 units
parsed 21 OCPP 1.6 security eventsThe extractor is not a naïve scrape. It re-learns the column offsets at each repeated page header, rejoins names the PDF broke mid-word (NetworkProfileConnectionAtte + mpts), distinguishes a wrapped name from a new row, resolves the types of physical components' variables from the standardized-variable table, and parses Name[Instance](Attribute) into its parts. The result is asserted against the appendix in the crate's own tests.