codetics-ocpp16 0.1.0

Codetics OCPP: OCPP 1.6 (OCPP-J) message types with validation and typed dispatch
Documentation
  • Coverage
  • 10.34%
    60 out of 580 items documented0 out of 152 items with examples
  • Size
  • Source code size: 156.6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.0 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • kevinvavelin

codetics-ocpp16

Every OCPP 1.6 (OCPP-J) message as plain Rust types, following the specification's type names and the 1.6-J errata 2025-04 (both Celcius and Celsius accepted, StopTransaction.reason optional):

  • serde mappings matching the message definitions (required fields, enumerations, no unknown fields);
  • Validate implementations for length, range, cardinality and multipleOf constraints, with violations mapped to the right OCPP-J error code;
  • Action with message direction, and typed dispatch: StationCall (Charge Point → Central System) and CsmsCall (Central System → Charge Point).
use codetics_ocpp16::{DecodeError, StationCall};

let call = StationCall::decode("BootNotification", r#"{"chargePointVendor":"VendorX","chargePointModel":"X1"}"#).unwrap();
let StationCall::BootNotification(boot) = call else { unreachable!() };
assert_eq!(boot.charge_point_vendor, "VendorX");

// Reset is sent by the Central System, not by a Charge Point.
assert!(matches!(StationCall::decode("Reset", r#"{"type":"Hard"}"#), Err(DecodeError::WrongDirection(_))));

Part of Codetics OCPP

This crate belongs to Codetics OCPP, a complete OCPP 1.6J / 2.0.1 / 2.1 implementation in Rust written by Kevin Vavelin (Codetics). It can be used as is; contributions are welcome.

License and credit

Licensed under the Apache License, Version 2.0.

Copyright 2026 Kevin Vavelin, Codetics. Any redistribution of this crate or of a work derived from it (including forks and products embedding it) must keep the copyright notice and include the NOTICE file crediting Kevin Vavelin / Codetics as the origin of the work.