ocpp/v2_1/datatype/total_cost
OCPP 2.1 TotalCost data type (schema TotalCostType).
to_json/decoder map to/from its OCPP-J JSON object; new (when
present) builds a value from the required fields only.
Types
This contains the cost calculated during a transaction. It is used both for running cost and final cost of the transaction.
| Field | Type | Req | Description |
|---|---|---|---|
charging_time | Price | — | |
currency | String | ✓ | Currency of the costs in ISO 4217 Code. (max 3 chars) |
custom_data | CustomData | — | |
energy | Price | — | |
fixed | Price | — | |
idle_time | Price | — | |
reservation_fixed | Price | — | |
reservation_time | Price | — | |
total | TotalPrice | ✓ | |
type_of_cost | TariffCost | ✓ |
Schema: TotalCostType
pub type TotalCost {
TotalCost(
charging_time: option.Option(price.Price),
currency: String,
custom_data: option.Option(custom_data.CustomData),
energy: option.Option(price.Price),
fixed: option.Option(price.Price),
idle_time: option.Option(price.Price),
reservation_fixed: option.Option(price.Price),
reservation_time: option.Option(price.Price),
total: total_price.TotalPrice,
type_of_cost: tariff_cost.TariffCost,
)
}
Constructors
-
TotalCost( charging_time: option.Option(price.Price), currency: String, custom_data: option.Option(custom_data.CustomData), energy: option.Option(price.Price), fixed: option.Option(price.Price), idle_time: option.Option(price.Price), reservation_fixed: option.Option(price.Price), reservation_time: option.Option(price.Price), total: total_price.TotalPrice, type_of_cost: tariff_cost.TariffCost, )
Values
pub fn decoder() -> decode.Decoder(TotalCost)
Decode a TotalCost from its OCPP-J JSON object, enforcing schema constraints.
pub fn new(
currency currency: String,
total total: total_price.TotalPrice,
type_of_cost type_of_cost: tariff_cost.TariffCost,
) -> TotalCost
Construct a TotalCost from its required fields, with every optional field set to None.