-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor/rename v201 to v2 #991
Conversation
3d63d48
to
9b3af7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, it builds, the tests run and the integration tests seem to run as well.
I had some minor changes I would do as well and at least one important thing (OcppProtocolVersion)
CMakeLists.txt
Outdated
@@ -19,10 +19,10 @@ option(OCPP_INSTALL "Install the library (shared data might be installed anyway) | |||
option(LIBOCPP_ENABLE_DEPRECATED_WEBSOCKETPP "Websocket++ has been removed from the project" OFF) | |||
|
|||
option(LIBOCPP_ENABLE_V16 "Enable OCPP 1.6 in the ocpp library" ON) | |||
option(LIBOCPP_ENABLE_V201 "Enable OCPP 2.0.1 in the ocpp library" ON) | |||
option(LIBOCPP_ENABLE_V2 "Enable OCPP 2.0.1 in the ocpp library" ON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Enable OCPP 2.0.1 / 2.1 in the ocpp library"
Because we will forget later on to add 2.1 there :)
config/v2/CMakeLists.txt
Outdated
set(MIGRATION_FILES_DEVICE_MODEL_SOURCE_DIR_V201 ${MIGRATION_FILES_DEVICE_MODEL_LOCATION} PARENT_SCOPE) | ||
set(MIGRATION_DEVICE_MODEL_FILE_VERSION_V2 ${TARGET_MIGRATION_FILE_VERSION} PARENT_SCOPE) | ||
set(MIGRATION_FILES_SOURCE_DIR_V2 ${MIGRATION_FILES_LOCATION} PARENT_SCOPE) | ||
set(MIGRATION_FILES_DEVICE_MODEL_SOURCE_DIR_V2 ${MIGRATION_FILES_DEVICE_MODEL_LOCATION} PARENT_SCOPE) | ||
|
||
option(LIBOCPP_INSTALL_DEVICE_MODEL_DATABASE "Install device model database for OCPP201" ON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for OCPP2x
?
doc/common/getting_started.md
Outdated
@@ -60,4 +69,4 @@ Please see the [Getting Started documentation for OCPP2.0.1](../v201/getting_sta | |||
You will find the generated doxygen documentation at: | |||
`build/dist/docs/html/index.html` | |||
|
|||
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::v201::ChargePoint class defined in `v201/charge_point.hpp` . | |||
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` . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.0.1/2.1
?
Because otherwise we will forget it anyway.
include/ocpp/common/types.hpp
Outdated
@@ -610,7 +610,7 @@ std::ostream& operator<<(std::ostream& os, const CertificateHashDataChain& k); | |||
|
|||
enum class OcppProtocolVersion { | |||
v16, | |||
v201, | |||
v2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, this one should still be v201
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good one
include/ocpp/v2/charge_point.hpp
Outdated
@@ -126,7 +126,7 @@ class ChargePointInterface { | |||
/// \param charging_state The new charging state | |||
virtual void | |||
on_transaction_started(const int32_t evse_id, const int32_t connector_id, const std::string& session_id, | |||
const DateTime& timestamp, const ocpp::v201::TriggerReasonEnum trigger_reason, | |||
const DateTime& timestamp, const ocpp::v2::TriggerReasonEnum trigger_reason, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove ocpp::v2::
here anyway if you want.
const std::optional<ocpp::v201::EVSE>& evse, | ||
const std::optional<ocpp::v201::IdToken>& id_token, | ||
const std::optional<std::vector<ocpp::v201::MeterValue>>& meter_value, | ||
const std::optional<ocpp::v2::EVSE>& evse, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this file, if you want to, ocpp::v2::
can be removed (it is already in this namespace).
@@ -613,8 +613,8 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), | |||
|
|||
if version == '1.6' or version == '16' or version == 'v16': | |||
version_path = 'v16' | |||
elif version == '2.0.1' or version == '201' or version == 'v201': | |||
version_path = 'v201' | |||
elif version == '2.0.1' or version == '201' or version == 'v2': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does not seem correct. I would revert (so change back to v201
) and add the 2.1 cases here (or version == '2.1' or version == '21' or version == 'v21'
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the version
is used in the templates for namespaces etc. so setting the version_path
to v2 here should be correct. In the condition I changed it back to version == 'v2'
though
Maybe this has to be changed as well: libocpp/config/v2/CMakeLists.txt Line 9 in 9b3af7a
libocpp/config/v2/CMakeLists.txt Line 16 in 9b3af7a
libocpp/config/v2/CMakeLists.txt Line 23 in 9b3af7a
libocpp/config/v2/CMakeLists.txt Line 31 in 9b3af7a
libocpp/config/v2/CMakeLists.txt Line 43 in 9b3af7a
libocpp/tests/libocpp-unittests.cmake Line 10 in 9b3af7a
But I am not sure if everything will go well then? libocpp/include/ocpp/v2/charge_point.hpp Line 80 in 9b3af7a
libocpp/lib/ocpp/v2/charge_point.cpp Line 266 in 9b3af7a
Not very interesting:
|
And some more things (to think about, not necessarily needed now):
Line 22 in 9b3af7a
Comment change? : libocpp/tests/libocpp-unittests.cmake Line 66 in 9b3af7a
libocpp/lib/ocpp/v2/connectivity_manager.cpp Line 430 in 9b3af7a
libocpp/include/ocpp/v2/types.hpp Line 14 in 9b3af7a
libocpp/include/ocpp/v2/device_model.hpp Line 144 in 9b3af7a
libocpp/include/ocpp/v2/charge_point.hpp Line 56 in 9b3af7a
libocpp/include/ocpp/v2/charge_point.hpp Line 326 in 9b3af7a
libocpp/include/ocpp/v2/charge_point.hpp Line 447 in 9b3af7a
libocpp/include/ocpp/v2/charge_point.hpp Line 502 in 9b3af7a
libocpp/include/ocpp/v2/charge_point.hpp Line 504 in 9b3af7a
Maybe add 2.1 to the dropdown? Although I think that's a bit early probably (but then we don't forget).
|
Signed-off-by: Piet Gömpel <[email protected]>
7cc099b
to
245a75d
Compare
* Added clarifications of directory structure in getting started guide Signed-off-by: Piet Gömpel <[email protected]>
245a75d
to
7c69398
Compare
Describe your changes
Since OCPP2.1 is backwards compatible with OCPP2.0.1 and we are reusing a lot of code and configuration that is now in
v201
directories and namespaces for the implementation of OCPP2.1, the namev201
is missleading. We therefore decided to rename all directories and namespaces fromv201
tov2
.v2
can then cover the implementation of OCPP2.0.1 and OCPP2.1. All files that are only introduced for the implementation of OCPP2.1 will go into av21
directory (e.g. generated messages).This PR renames all directories with the name
v201
tov2
and all occurances ofv201
orV201
tov2
andV2
.I added a clarification for the directory structure and namespaces here
Issue ticket number and link
Checklist before requesting a review