# 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).
```rust
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](https://codetics.fr), a complete OCPP 1.6J / 2.0.1 / 2.1
implementation in Rust written by **Kevin Vavelin** ([Codetics](https://codetics.fr)).
It can be used as is; contributions are welcome.
## License and credit
Licensed under the [Apache License, Version 2.0](LICENSE).
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](NOTICE) file crediting Kevin Vavelin / Codetics as the origin of the work.