-
Notifications
You must be signed in to change notification settings - Fork 4
Introduction of CbCPXDriver for upcoming new product "Charge Point eXtender" #47
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
Open
Erik827
wants to merge
1
commit into
main
Choose a base branch
from
feature/CbCpxDriver
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # | ||
| # AUTO GENERATED - MARKED REGIONS WILL BE KEPT | ||
| # template version 3 | ||
| # | ||
|
|
||
| # module setup: | ||
| # - ${MODULE_NAME}: module name | ||
| ev_setup_cpp_module() | ||
|
|
||
| # ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1 | ||
| # insert your custom targets and additional config variables here | ||
|
|
||
| find_package(PalSigslot REQUIRED) | ||
|
|
||
| add_subdirectory("cpx") | ||
|
|
||
| set(MODULE_DESCRIPTION "chargebyte's CPX EVerest module") | ||
| set(MODULE_VERSION ${PROJECT_VERSION}) | ||
|
|
||
| # make CMake project variables usable in source code | ||
| configure_file(configuration.h.in configuration.h @ONLY) | ||
|
|
||
| # create a VERSION file | ||
| configure_file(VERSION.in VERSION @ONLY) | ||
|
|
||
| target_link_libraries(${MODULE_NAME} | ||
| PRIVATE | ||
| Pal::Sigslot | ||
| nlohmann_json::nlohmann_json | ||
| cpx | ||
| utils::cp | ||
| ) | ||
| target_include_directories(${MODULE_NAME} | ||
| PRIVATE | ||
| ${CPX_INCLUDE_DIR} | ||
| ${CMAKE_CURRENT_BINARY_DIR} | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/cpx | ||
| ) | ||
| # ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1 | ||
|
|
||
| target_sources(${MODULE_NAME} | ||
| PRIVATE | ||
| "evse_board_support/evse_board_supportImpl.cpp" | ||
| "temperatures/cb_temperaturesImpl.cpp" | ||
| ) | ||
|
|
||
| # ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1 | ||
| # insert other things like install cmds etc here | ||
|
|
||
| install(FILES "${CMAKE_CURRENT_BINARY_DIR}/VERSION" | ||
| DESTINATION "${EVEREST_MODULE_INSTALL_PREFIX}/${MODULE_NAME}" | ||
| ) | ||
| # ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // Copyright Pionix GmbH and Contributors to EVerest | ||
| #include "CbCPXDriver.hpp" | ||
| #include "configuration.h" | ||
|
|
||
| using namespace std::chrono_literals; | ||
|
|
||
| namespace module { | ||
|
|
||
| void CbCPXDriver::init() { | ||
| types::evse_board_support::Connector_type connector_type = | ||
| types::evse_board_support::string_to_connector_type(this->config.connector_type); | ||
| const bool is_pluggable = connector_type == types::evse_board_support::Connector_type::IEC62196Type2Socket; | ||
|
|
||
| // instantiate CPX controller | ||
| this->controller = | ||
| std::make_unique<CbCPX>(this->config.device_id, this->config.can_interface, this->config.can_bitrate); | ||
| this->controller->init(is_pluggable); | ||
|
|
||
| // initialize the interfaces now | ||
| invoke_init(*this->p_evse_board_support); | ||
| invoke_init(*this->p_temperatures); | ||
|
|
||
| EVLOG_info << MODULE_DESCRIPTION << " (version: " << MODULE_VERSION << ")"; | ||
| } | ||
|
|
||
| void CbCPXDriver::ready() { | ||
| invoke_ready(*this->p_evse_board_support); | ||
| invoke_ready(*this->p_temperatures); | ||
| } | ||
|
|
||
| } // namespace module |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // Copyright Pionix GmbH and Contributors to EVerest | ||
| #ifndef CB_CPXDRIVER_HPP | ||
| #define CB_CPXDRIVER_HPP | ||
|
|
||
| // | ||
| // AUTO GENERATED - MARKED REGIONS WILL BE KEPT | ||
| // template version 2 | ||
| // | ||
|
|
||
| #include "ld-ev.hpp" | ||
|
|
||
| // headers for provided interface implementations | ||
| #include <generated/interfaces/evse_board_support/Implementation.hpp> | ||
| #include <generated/interfaces/cb_temperatures/Implementation.hpp> | ||
|
|
||
| // ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1 | ||
| // insert your custom include headers here | ||
|
|
||
| #include "cpx/CbCPX.hpp" | ||
| // ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1 | ||
|
|
||
| namespace module { | ||
|
|
||
| struct Conf { | ||
| std::string connector_type; | ||
| double min_current_A; | ||
| double max_current_A; | ||
| std::string can_interface; | ||
| int can_bitrate; | ||
| std::string pt1000_1_identification; | ||
| std::string pt1000_2_identification; | ||
| std::string pt1000_3_identification; | ||
| std::string pt1000_4_identification; | ||
| int device_id; | ||
| }; | ||
|
|
||
| class CbCPXDriver : public Everest::ModuleBase { | ||
| public: | ||
| CbCPXDriver() = delete; | ||
| CbCPXDriver(const ModuleInfo& info, std::unique_ptr<evse_board_supportImplBase> p_evse_board_support, | ||
| std::unique_ptr<cb_temperaturesImplBase> p_temperatures, Conf& config) : | ||
| ModuleBase(info), | ||
| p_evse_board_support(std::move(p_evse_board_support)), | ||
| p_temperatures(std::move(p_temperatures)), | ||
| config(config) {}; | ||
|
|
||
| const std::unique_ptr<evse_board_supportImplBase> p_evse_board_support; | ||
| const std::unique_ptr<cb_temperaturesImplBase> p_temperatures; | ||
| const Conf& config; | ||
|
|
||
| // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 | ||
| // insert your public definitions here | ||
|
|
||
| /// @brief Helper to signal thread termination wish | ||
| std::atomic_bool termination_requested {false}; | ||
|
|
||
| /// @brief CPX CAN Interface | ||
| std::unique_ptr<CbCPX> controller; | ||
| // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 | ||
|
|
||
| protected: | ||
| // ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1 | ||
| // insert your protected definitions here | ||
| // ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1 | ||
|
|
||
| private: | ||
| friend class LdEverest; | ||
| void init(); | ||
| void ready(); | ||
|
|
||
| // ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1 | ||
| // insert your private definitions here | ||
| // ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1 | ||
| }; | ||
|
|
||
| // ev@087e516b-124c-48df-94fb-109508c7cda9:v1 | ||
| // insert other definitions here | ||
| // ev@087e516b-124c-48df-94fb-109508c7cda9:v1 | ||
|
|
||
| } // namespace module | ||
|
|
||
| #endif // CB_CPXDRIVER_HPP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| @MODULE_DESCRIPTION@ | ||
| Version: @MODULE_VERSION@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #pragma once | ||
|
|
||
| #define MODULE_NAME "@MODULE_NAME@" | ||
| #define MODULE_DESCRIPTION "@MODULE_DESCRIPTION@" | ||
| #define MODULE_VERSION "@MODULE_VERSION@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| set(CPX_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PARENT_SCOPE) | ||
|
|
||
| add_library(cpx STATIC) | ||
|
|
||
| find_package(PkgConfig REQUIRED) | ||
| pkg_check_modules(LIBSOCKETCAN REQUIRED libsocketcan) | ||
|
|
||
| target_sources(cpx | ||
| PRIVATE | ||
| "CbCPX.cpp" | ||
| "can_interface/can.c" | ||
| ) | ||
|
|
||
| get_target_property(GENERATED_INCLUDE_DIR generate_cpp_files EVEREST_GENERATED_INCLUDE_DIR) | ||
|
|
||
| target_include_directories(cpx | ||
| PRIVATE | ||
| ${GENERATED_INCLUDE_DIR} | ||
| ${CMAKE_SOURCE_DIR}/../everest-framework/include | ||
| ${CMAKE_SOURCE_DIR}/build/_deps/nlohmann_json_schema_validator-src/src | ||
| ${LIBSOCKETCAN_INCLUDE_DIRS} | ||
| ) | ||
|
|
||
| target_include_directories(cpx PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
|
||
| add_dependencies(cpx generate_cpp_files) | ||
|
|
||
| target_link_libraries(cpx | ||
| PRIVATE | ||
| Pal::Sigslot | ||
| nlohmann_json::nlohmann_json | ||
| everest::log | ||
| ${LIBSOCKETCAN_LIBRARIES} | ||
| ) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 don't see you using Boost headers anywhere in this lib or this module? Neither sqlite. Same assumption as above regarding CbCpx. Drop these. See there (CbCpx).