Skip to content

Commit b0c5eba

Browse files
committed
Adapt examples and tests to changes required for multiple "provides"
These changes are implemented in: everest-framework: EVerest/everest-framework#287 everest-utils: EVerest/everest-utils#195 Signed-off-by: Kai-Uwe Hermann <[email protected]>
1 parent e30ba85 commit b0c5eba

File tree

24 files changed

+312
-31
lines changed

24 files changed

+312
-31
lines changed

MODULE.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ module(
88
###############################################################################
99

1010
bazel_dep(name = "everest-framework", version = "0.22.2")
11-
git_override(module_name="everest-framework", commit="41ae8d15cffd79c4b270f5e0e811f562594063bc", remote="https://github.com/EVerest/everest-framework")
11+
git_override(module_name="everest-framework", commit="ba28128e292842da5728a09c2e07e65a0be71da5", remote="https://github.com/EVerest/everest-framework")
1212

1313
bazel_dep(name = "everest-utils", version = "0.6.0")
14-
git_override(module_name="everest-utils", commit="f1117f9d6a9a2fe29d350dd50ecc727a7101ead1", remote="https://github.com/EVerest/everest-utils")
14+
git_override(module_name="everest-utils", commit="8940f6971f7e165a6e50586595d0f4b53068da76", remote="https://github.com/EVerest/everest-utils")
1515

1616
bazel_dep(name = "bazel_features", version = "1.21.0")
1717
bazel_dep(name = "bazel_skylib", version = "1.7.1")

config/config-example.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,11 @@ active_modules:
1919
example:
2020
- module_id: example
2121
implementation_id: example
22+
example_multiple:
23+
- module_id: example
24+
implementation_id: example_multiple.0 # TODO: use .0 ... .127 index syntax
25+
- module_id: example
26+
implementation_id: example_multiple.1
27+
# - module_id: example
28+
# implementation_id: example_multiple.2
2229
module: ExampleUser

dependencies.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
---
55
everest-framework:
66
git: https://github.com/EVerest/everest-framework.git
7-
git_tag: v0.22.2
7+
git_tag: ba28128e292842da5728a09c2e07e65a0be71da5
88
options: [
99
"BUILD_TESTING OFF",
1010
"everest-framework_USE_PYTHON_VENV ${PROJECT_NAME}_USE_PYTHON_VENV",
@@ -89,7 +89,7 @@ Josev:
8989
# everest-testing and ev-dev-tools
9090
everest-utils:
9191
git: https://github.com/EVerest/everest-utils.git
92-
git_tag: v0.6.0
92+
git_tag: 8940f6971f7e165a6e50586595d0f4b53068da76 # FIXME: v0.7.0
9393
# linux_libnfc-nci for RFID
9494
libnfc-nci:
9595
git: https://github.com/EVerest/linux_libnfc-nci.git
@@ -104,7 +104,7 @@ gtest:
104104
cmake_condition: "EVEREST_CORE_BUILD_TESTING"
105105
everest-sqlite:
106106
git: https://github.com/EVerest/everest-sqlite.git
107-
git_tag: v0.1.2
107+
git_tag: v0.1.3
108108
catch2:
109109
git: https://github.com/catchorg/Catch2.git
110110
git_tag: v3.4.0

interfaces/example.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ vars:
1616
max_current:
1717
description: Provides maximum current of this supply in ampere
1818
type: number
19+
errors:
20+
- reference: /errors/example#/ExampleErrorA

modules/EvseManager/tests/ErrorHandlingTest.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ struct EvseManagerModuleAdapterStub : public module::stub::EvseManagerModuleAdap
6666
error_list{} {
6767
}
6868

69-
virtual std::shared_ptr<Everest::error::ErrorManagerImpl> get_error_manager_impl_fn(const std::string& str) {
70-
return std::make_shared<Everest::error::ErrorManagerImpl>(
69+
virtual std::vector<std::shared_ptr<Everest::error::ErrorManagerImpl>>
70+
get_error_manager_impl_fn(const std::string& str) {
71+
return {std::make_shared<Everest::error::ErrorManagerImpl>(
7172
error_type_map, std::make_shared<Everest::error::ErrorDatabaseMap>(), error_list,
7273
[this](const Everest::error::Error& error) {
7374
if (error_raise.find(error.type) == error_raise.end()) {
@@ -83,7 +84,7 @@ struct EvseManagerModuleAdapterStub : public module::stub::EvseManagerModuleAdap
8384
error_clear[error.type](error);
8485
active_errors.remove(error);
8586
},
86-
false);
87+
false)};
8788
}
8889

8990
virtual std::shared_ptr<Everest::error::ErrorManagerReq> get_error_manager_req_fn(const Requirement& req) {
@@ -100,8 +101,9 @@ struct EvseManagerModuleAdapterStub : public module::stub::EvseManagerModuleAdap
100101
return std::make_shared<Everest::error::ErrorFactory>(error_type_map);
101102
}
102103

103-
virtual std::shared_ptr<Everest::error::ErrorStateMonitor> get_error_state_monitor_impl_fn(const std::string&) {
104-
return std::make_shared<Everest::error::ErrorStateMonitor>(error_database);
104+
virtual std::vector<std::shared_ptr<Everest::error::ErrorStateMonitor>>
105+
get_error_state_monitor_impl_fn(const std::string&) {
106+
return {std::make_shared<Everest::error::ErrorStateMonitor>(error_database)};
105107
}
106108
};
107109

modules/EvseManager/tests/EvseManagerStub.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ struct EvseManagerModuleAdapter : public ModuleAdapterStub {
8888
});
8989
}
9090

91-
virtual std::shared_ptr<Everest::error::ErrorManagerImpl> get_error_manager_impl_fn(const std::string& str) {
92-
return std::make_shared<Everest::error::ErrorManagerImpl>(
91+
virtual std::vector<std::shared_ptr<Everest::error::ErrorManagerImpl>>
92+
get_error_manager_impl_fn(const std::string& str) {
93+
return {std::make_shared<Everest::error::ErrorManagerImpl>(
9394
std::make_shared<Everest::error::ErrorTypeMap>(), std::make_shared<Everest::error::ErrorDatabaseMap>(),
9495
std::list<Everest::error::ErrorType>(),
9596
[this](const Everest::error::Error& error) {
@@ -106,7 +107,7 @@ struct EvseManagerModuleAdapter : public ModuleAdapterStub {
106107
}
107108
error_clear[error.type](error);
108109
},
109-
false);
110+
false)};
110111
}
111112
};
112113

modules/examples/Example/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ target_sources(${MODULE_NAME}
1515
PRIVATE
1616
"example/exampleImpl.cpp"
1717
"store/kvsImpl.cpp"
18+
"example_multiple/exampleImpl.cpp"
1819
)
1920

2021
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1

modules/examples/Example/Example.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ namespace module {
66

77
void Example::init() {
88
invoke_init(*p_example);
9+
invoke_init(*p_example_multiple);
910
invoke_init(*p_store);
1011
}
1112

1213
void Example::ready() {
1314
invoke_ready(*p_example);
15+
invoke_ready(*p_example_multiple);
1416
invoke_ready(*p_store);
1517

1618
mqtt.publish("external/topic", "data");

modules/examples/Example/Example.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
// headers for provided interface implementations
1414
#include <generated/interfaces/example/Implementation.hpp>
15+
#include <generated/interfaces/example/ImplementationMultiple.hpp>
1516
#include <generated/interfaces/kvs/Implementation.hpp>
1617

1718
// headers for required interface implementations
@@ -29,17 +30,20 @@ class Example : public Everest::ModuleBase {
2930
public:
3031
Example() = delete;
3132
Example(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, std::unique_ptr<exampleImplBase> p_example,
32-
std::unique_ptr<kvsImplBase> p_store, std::unique_ptr<kvsIntf> r_kvs, Conf& config) :
33+
std::unique_ptr<kvsImplBase> p_store, std::unique_ptr<exampleImplBaseMultiple> p_example_multiple,
34+
std::unique_ptr<kvsIntf> r_kvs, Conf& config) :
3335
ModuleBase(info),
3436
mqtt(mqtt_provider),
3537
p_example(std::move(p_example)),
3638
p_store(std::move(p_store)),
39+
p_example_multiple(std::move(p_example_multiple)),
3740
r_kvs(std::move(r_kvs)),
3841
config(config){};
3942

4043
Everest::MqttProvider& mqtt;
4144
const std::unique_ptr<exampleImplBase> p_example;
4245
const std::unique_ptr<kvsImplBase> p_store;
46+
const std::unique_ptr<exampleImplBaseMultiple> p_example_multiple;
4347
const std::unique_ptr<kvsIntf> r_kvs;
4448
const Conf& config;
4549

modules/examples/Example/doc.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. _everest_modules_handwritten_Example:
2+
3+
.. This file is a placeholder for an optional single file
4+
handwritten documentation for the Example module.
5+
Please decide whether you want to use this single file,
6+
or a set of files in the doc/ directory.
7+
In the latter case, you can delete this file.
8+
In the former case, you can delete the doc/ directory.
9+
10+
.. This handwritten documentation is optional. In case
11+
you do not want to write it, you can delete this file
12+
and the doc/ directory.
13+
14+
.. The documentation can be written in reStructuredText,
15+
and will be converted to HTML and PDF by Sphinx.
16+
17+
*******************************************
18+
Example
19+
*******************************************
20+
21+
:ref:`Link <everest_modules_Example>` to the module's reference.
22+
Simple example module written in C++

0 commit comments

Comments
 (0)