ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
utils.hpp
1// SPDX-License-Identifier: Apache-2.0
2// Copyright Pionix GmbH and Contributors to EVerest
3#ifndef V2_UTILS_HPP
4#define V2_UTILS_HPP
5
6#include <ocpp/v2/ocpp_types.hpp>
7#include <ocpp/v2/types.hpp>
8namespace ocpp {
9namespace v2 {
10namespace utils {
11
14std::vector<MeasurandEnum> get_measurands_vec(const std::string& measurands_csv);
15
18bool meter_value_has_any_measurand(const MeterValue& _meter_value, const std::vector<MeasurandEnum>& measurands);
19
27MeterValue get_meter_value_with_measurands_applied(const MeterValue& _meter_value,
28 const std::vector<MeasurandEnum>& measurands,
29 bool include_signed = true);
30
39std::vector<MeterValue> get_meter_values_with_measurands_applied(
40 const std::vector<MeterValue>& meter_values, const std::vector<MeasurandEnum>& sampled_tx_ended_measurands,
41 const std::vector<MeasurandEnum>& aligned_tx_ended_measurands, ocpp::DateTime max_timestamp,
42 bool include_sampled_signed = true, bool include_aligned_signed = true);
43
50MeterValue set_meter_value_reading_context(const MeterValue& meter_value, const ReadingContextEnum reading_context);
51
55std::string sha256(const std::string& str);
56
60std::string generate_token_hash(const IdToken& token);
61
66ocpp::DateTime align_timestamp(const DateTime timestamp, std::chrono::seconds align_interval);
67
69std::optional<float> get_total_power_active_import(const MeterValue& meter_value);
70
72bool is_critical(const std::string& security_event);
73
75std::vector<ChargingProfilePurposeEnum> get_purposes_to_ignore(const std::string& csl, const bool is_offline);
76
77} // namespace utils
78} // namespace v2
79} // namespace ocpp
80
81#endif
Contains a DateTime implementation that can parse and create RFC 3339 compatible strings.
Definition: types.hpp:109