Skip to content

Commit 7cc099b

Browse files
committed
Addressed requested changes
Signed-off-by: Piet Gömpel <pietgoempel@gmail.com>
1 parent 9b3af7a commit 7cc099b

File tree

9 files changed

+15
-17
lines changed

9 files changed

+15
-17
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ option(OCPP_INSTALL "Install the library (shared data might be installed anyway)
1919
option(LIBOCPP_ENABLE_DEPRECATED_WEBSOCKETPP "Websocket++ has been removed from the project" OFF)
2020

2121
option(LIBOCPP_ENABLE_V16 "Enable OCPP 1.6 in the ocpp library" ON)
22-
option(LIBOCPP_ENABLE_V2 "Enable OCPP 2.0.1 in the ocpp library" ON)
22+
option(LIBOCPP_ENABLE_V2 "Enable OCPP 2.0.1 and OCPP2.1 in the ocpp library" ON)
2323

2424
if((NOT LIBOCPP_ENABLE_V16) AND (NOT LIBOCPP_ENABLE_V2))
2525
message(FATAL_ERROR "At least one of LIBOCPP_ENABLE_V16 and LIBOCPP_ENABLE_V2 needs to be ON")

config/v2/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set(MIGRATION_DEVICE_MODEL_FILE_VERSION_V2 ${TARGET_MIGRATION_FILE_VERSION} PARE
2020
set(MIGRATION_FILES_SOURCE_DIR_V2 ${MIGRATION_FILES_LOCATION} PARENT_SCOPE)
2121
set(MIGRATION_FILES_DEVICE_MODEL_SOURCE_DIR_V2 ${MIGRATION_FILES_DEVICE_MODEL_LOCATION} PARENT_SCOPE)
2222

23-
option(LIBOCPP_INSTALL_DEVICE_MODEL_DATABASE "Install device model database for OCPP201" ON)
23+
option(LIBOCPP_INSTALL_DEVICE_MODEL_DATABASE "Install device model database for OCPP2.0.1 and OCPP2.1" ON)
2424

2525
list(APPEND CONFIGS
2626
../logging.ini

doc/common/getting_started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ Please see the [Getting Started documentation for OCPP2.0.1](../v2/getting_start
6969
You will find the generated doxygen documentation at:
7070
`build/dist/docs/html/index.html`
7171

72-
The main reference for the integration of libocpp for OCPP1.6 is the ocpp::v16::ChargePoint class defined in `v16/charge_point.hpp` , for OCPP2.0.1 that is the ocpp::v2::ChargePoint class defined in `v2/charge_point.hpp` .
72+
The main reference for the integration of libocpp for OCPP1.6 is the ocpp::v16::ChargePoint class defined in `v16/charge_point.hpp` , for OCPP2.0.1 and OCPP2.1 that is the ocpp::v2::ChargePoint class defined in `v2/charge_point.hpp` .

include/ocpp/common/types.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ std::ostream& operator<<(std::ostream& os, const CertificateHashDataChain& k);
610610

611611
enum class OcppProtocolVersion {
612612
v16,
613-
v2,
613+
v201,
614614
v21,
615615
Unknown,
616616
};

include/ocpp/v2/charge_point.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class ChargePointInterface {
126126
/// \param charging_state The new charging state
127127
virtual void
128128
on_transaction_started(const int32_t evse_id, const int32_t connector_id, const std::string& session_id,
129-
const DateTime& timestamp, const ocpp::v2::TriggerReasonEnum trigger_reason,
129+
const DateTime& timestamp, const TriggerReasonEnum trigger_reason,
130130
const MeterValue& meter_start, const std::optional<IdToken>& id_token,
131131
const std::optional<IdToken>& group_id_token, const std::optional<int32_t>& reservation_id,
132132
const std::optional<int32_t>& remote_start_id, const ChargingStateEnum charging_state) = 0;
@@ -523,7 +523,7 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa
523523
on_get_15118_ev_certificate_request(const Get15118EVCertificateRequest& request) override;
524524

525525
void on_transaction_started(const int32_t evse_id, const int32_t connector_id, const std::string& session_id,
526-
const DateTime& timestamp, const ocpp::v2::TriggerReasonEnum trigger_reason,
526+
const DateTime& timestamp, const TriggerReasonEnum trigger_reason,
527527
const MeterValue& meter_start, const std::optional<IdToken>& id_token,
528528
const std::optional<IdToken>& group_id_token,
529529
const std::optional<int32_t>& reservation_id,

include/ocpp/v2/functional_blocks/transaction.hpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class TransactionInterface : public MessageHandlerInterface {
4646
/// \param charging_state The new charging state
4747
virtual void
4848
on_transaction_started(const int32_t evse_id, const int32_t connector_id, const std::string& session_id,
49-
const DateTime& timestamp, const ocpp::v2::TriggerReasonEnum trigger_reason,
49+
const DateTime& timestamp, const TriggerReasonEnum trigger_reason,
5050
const MeterValue& meter_start, const std::optional<IdToken>& id_token,
5151
const std::optional<IdToken>& group_id_token, const std::optional<int32_t>& reservation_id,
5252
const std::optional<int32_t>& remote_start_id, const ChargingStateEnum charging_state) = 0;
@@ -69,12 +69,10 @@ class TransactionInterface : public MessageHandlerInterface {
6969

7070
// Functional Block E: Transactions
7171
virtual void transaction_event_req(const TransactionEventEnum& event_type, const DateTime& timestamp,
72-
const ocpp::v2::Transaction& transaction,
73-
const ocpp::v2::TriggerReasonEnum& trigger_reason, const int32_t seq_no,
74-
const std::optional<int32_t>& cable_max_current,
75-
const std::optional<ocpp::v2::EVSE>& evse,
76-
const std::optional<ocpp::v2::IdToken>& id_token,
77-
const std::optional<std::vector<ocpp::v2::MeterValue>>& meter_value,
72+
const Transaction& transaction, const TriggerReasonEnum& trigger_reason,
73+
const int32_t seq_no, const std::optional<int32_t>& cable_max_current,
74+
const std::optional<EVSE>& evse, const std::optional<IdToken>& id_token,
75+
const std::optional<std::vector<MeterValue>>& meter_value,
7876
const std::optional<int32_t>& number_of_phases_used, const bool offline,
7977
const std::optional<int32_t>& reservation_id,
8078
const bool initiated_by_trigger_message = false) = 0;

lib/ocpp/common/types.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ std::string ocpp_protocol_version_to_string(OcppProtocolVersion e) {
10621062
switch (e) {
10631063
case OcppProtocolVersion::v16:
10641064
return "ocpp1.6";
1065-
case OcppProtocolVersion::v2:
1065+
case OcppProtocolVersion::v201:
10661066
return "ocpp2.0.1";
10671067
case OcppProtocolVersion::v21:
10681068
return "ocpp2.1";
@@ -1078,7 +1078,7 @@ OcppProtocolVersion string_to_ocpp_protocol_version(const std::string& s) {
10781078
return OcppProtocolVersion::v16;
10791079
}
10801080
if (s == "ocpp2.0.1") {
1081-
return OcppProtocolVersion::v2;
1081+
return OcppProtocolVersion::v201;
10821082
}
10831083
if (s == "ocpp2.1") {
10841084
return OcppProtocolVersion::v21;

lib/ocpp/v2/connectivity_manager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ ConnectivityManager::get_ws_connection_options(const int32_t configuration_slot)
337337
network_connection_profile.securityProfile);
338338

339339
WebsocketConnectionOptions connection_options{
340-
{OcppProtocolVersion::v2},
340+
{OcppProtocolVersion::v201},
341341
uri,
342342
network_connection_profile.securityProfile,
343343
this->device_model.get_optional_value<std::string>(ControllerComponentVariables::BasicAuthPassword),

src/code_generator/common/generate_cpp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'),
613613

614614
if version == '1.6' or version == '16' or version == 'v16':
615615
version_path = 'v16'
616-
elif version == '2.0.1' or version == '201' or version == 'v2':
616+
elif version == '2.0.1' or version == '201' or version == 'v201':
617617
version_path = 'v2'
618618
else:
619619
raise ValueError(f"Version {version} not a valid ocpp version")

0 commit comments

Comments
 (0)