Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lib/everest/ocpp/include/ocpp/v16/charge_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <ocpp/common/evse_security.hpp>
#include <ocpp/common/evse_security_impl.hpp>
#include <ocpp/common/support_older_cpp_versions.hpp>
#include <ocpp/v16/charge_point_configuration_interface.hpp>

Check warning on line 10 in lib/everest/ocpp/include/ocpp/v16/charge_point.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/ocpp/include/ocpp/v16/charge_point.hpp#L10

Include file: <ocpp/v16/charge_point_configuration_interface.hpp> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <ocpp/v16/charge_point_state_machine.hpp>
#include <ocpp/v16/ocpp_types.hpp>
#include <ocpp/v16/smart_charging.hpp>
Expand Down Expand Up @@ -78,6 +79,26 @@
const std::shared_ptr<EvseSecurity> evse_security,
const std::optional<SecurityConfiguration> security_configuration = std::nullopt);

/// \brief The main entrypoint for libOCPP for OCPP 1.6
/// \param config unique pointer to a configuration object
/// \param database_path this points to the location of the sqlite database that libocpp uses to keep track of
/// connector availability, the authorization cache and auth list, charging profiles and transaction data
/// \param sql_init_path this points to the init.sql file which contains the database schema used by libocpp for its
/// sqlite database
/// \param message_log_path this points to the directory in which libocpp can put OCPP communication logfiles for
/// debugging purposes. This behavior can be controlled by the "LogMessages" (set to true by default) and
/// "LogMessagesFormat" (set to ["log", "html", "session_logging"] by default, "console" and "console_detailed" are
/// also available) configuration keys in the "Internal" section of the config file. Please note that this is
/// intended for debugging purposes only as it logs all communication, including authentication messages.
/// \param evse_security Pointer to evse_security that manages security related operations; if nullptr
/// security_configuration must be set
/// \param security_configuration specifies the file paths that are required to set up the internal evse_security
/// implementation
explicit ChargePoint(std::unique_ptr<ChargePointConfigurationInterface> config, const fs::path& database_path,
const fs::path& sql_init_path, const fs::path& message_log_path,
const std::shared_ptr<EvseSecurity> evse_security,
const std::optional<SecurityConfiguration> security_configuration = std::nullopt);

~ChargePoint();

/// @} // End constructors 1.6 group
Expand Down
696 changes: 345 additions & 351 deletions lib/everest/ocpp/include/ocpp/v16/charge_point_configuration.hpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2026 Pionix GmbH and Contributors to EVerest

#ifndef OCPP_V16_CHARGE_POINT_CONFIGURATION_BASE_HPP
#define OCPP_V16_CHARGE_POINT_CONFIGURATION_BASE_HPP

#include <ocpp/v16/types.hpp>

#include <cstddef>

Check warning on line 9 in lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp#L9

Include file: <cstddef> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <map>

Check warning on line 10 in lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp#L10

Include file: <map> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <optional>

Check warning on line 11 in lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp#L11

Include file: <optional> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <set>

namespace ocpp::v16 {

constexpr std::size_t AUTHORIZATION_KEY_MIN_LENGTH = 8;
constexpr std::size_t OCSP_REQUEST_INTERVAL_MIN = 86400;
constexpr std::size_t SECC_LEAF_SUBJECT_COMMON_NAME_MIN_LENGTH = 7;
constexpr std::size_t SECC_LEAF_SUBJECT_COMMON_NAME_MAX_LENGTH = 64;
constexpr std::size_t SECC_LEAF_SUBJECT_COUNTRY_LENGTH = 2;
constexpr std::size_t SECC_LEAF_SUBJECT_ORGANIZATION_MAX_LENGTH = 64;
constexpr std::size_t CONNECTOR_EVSE_IDS_MAX_LENGTH = 1000;
constexpr std::int32_t MAX_WAIT_FOR_SET_USER_PRICE_TIMEOUT_MS = 30000;

/// \brief contains the configuration of the charge point
class ChargePointConfigurationBase {
public:
using MessagesSet = std::set<MessageType>;
using ProfilesSet = std::set<SupportedFeatureProfiles>;
using FeaturesMap = std::map<SupportedFeatureProfiles, MessagesSet>;
using MeasurandsMap = std::map<Measurand, std::vector<Phase>>;
using MeasurandWithPhaseList = std::vector<MeasurandWithPhase>;

protected:
static const FeaturesMap supported_message_types_from_charge_point;

Check warning on line 35 in lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp#L35

class member 'ChargePointConfigurationBase::supported_message_types_from_charge_point' is never used.
static const FeaturesMap supported_message_types_from_central_system;

Check warning on line 36 in lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp#L36

class member 'ChargePointConfigurationBase::supported_message_types_from_central_system' is never used.

MessagesSet supported_message_types_receiving;

Check warning on line 38 in lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp#L38

class member 'ChargePointConfigurationBase::supported_message_types_receiving' is never used.
MessagesSet supported_message_types_sending;

Check warning on line 39 in lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp#L39

class member 'ChargePointConfigurationBase::supported_message_types_sending' is never used.
ProfilesSet supported_feature_profiles;

Check warning on line 40 in lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp#L40

class member 'ChargePointConfigurationBase::supported_feature_profiles' is never used.
MeasurandsMap supported_measurands;

Check warning on line 41 in lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/everest/ocpp/include/ocpp/v16/charge_point_configuration_base.hpp#L41

class member 'ChargePointConfigurationBase::supported_measurands' is never used.

void initialise(const ProfilesSet& initial_set, const std::optional<std::string>& supported_profiles_csl,
const std::optional<std::string>& supported_measurands_csl);

public:
bool is_valid_supported_measurands(const std::string& csl);
std::optional<MeasurandWithPhaseList> csv_to_measurand_with_phase_vector(const std::string& csl);

static std::optional<std::uint32_t> extract_connector_id(const std::string& str);
static std::string MeterPublicKey_string(std::uint32_t connector_id);

static bool to_bool(const std::string& value);
static bool isBool(const std::string& str);
static bool isPositiveInteger(const std::string& str);
static bool isConnectorPhaseRotationValid(std::int32_t num_connectors, const std::string& value);
static bool isTimeOffset(const std::string& offset);
static bool areValidEvseIds(const std::string& value);
static std::string hexToString(const std::string& s);
static bool isHexNotation(const std::string& s);
};

} // namespace ocpp::v16

#endif // OCPP_V16_CHARGE_POINT_CONFIGURATION_BASE_HPP
Loading
Loading