Skip to content

Commit e45e808

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/add-linux-systemd-rauc
Signed-off-by: Kai-Uwe Hermann <[email protected]>
2 parents 20870ed + c54d1b9 commit e45e808

File tree

18 files changed

+397
-91
lines changed

18 files changed

+397
-91
lines changed

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ bazel_dep(name = "boost.process", version = BOOST_VERSION)
2525
bazel_dep(name = "boost.uuid", version = BOOST_VERSION)
2626
bazel_dep(name = "fmt", version = "11.1.4", repo_name = "com_github_fmtlib_fmt")
2727
bazel_dep(name = "nlohmann_json", version = "3.12.0", repo_name = "com_github_nlohmann_json")
28+
bazel_dep(name = "libcap", version = "2.27")
2829
bazel_dep(name = "openssl", version = "3.3.1.bcr.1")
2930
bazel_dep(name = "platforms", version = "0.0.10")
3031
bazel_dep(name = "rules_cc", version = "0.0.9")

dependencies.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ libcurl:
7373
# of libocpp and would otherwise be overwritten by the version used there
7474
libevse-security:
7575
git: https://github.com/EVerest/libevse-security.git
76-
git_tag: v0.9.8
76+
git_tag: bf5a015cfeacad72509c1620464460753e5a5bec
7777
cmake_condition: "EVEREST_DEPENDENCY_ENABLED_LIBEVSE_SECURITY"
7878

7979
# OCPP
@@ -100,6 +100,11 @@ ftxui:
100100
git: https://github.com/ArthurSonzogni/ftxui
101101
git_tag: v5.0.0
102102
cmake_condition: "EVEREST_DEPENDENCY_ENABLED_FTXUI"
103+
# everest/io library
104+
mqttc:
105+
git: https://github.com/LiamBindle/MQTT-C.git
106+
git_tag: v1.1.6
107+
options: ["MQTT_C_EXAMPLES OFF", "CMAKE_POSITION_INDEPENDENT_CODE ON"]
103108
# unit testing
104109
gtest:
105110
# GoogleTest now follows the Abseil Live at Head philosophy. We recommend updating to the latest commit in the main branch as often as possible.

lib/everest/io/CMakeLists.txt

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,9 @@
1-
cmake_minimum_required(VERSION 3.22)
2-
3-
project(IO VERSION 0.1
4-
DESCRIPTION "Event driven IO"
5-
LANGUAGES CXX C
6-
)
7-
8-
set(CMAKE_EXPORT_COMPILE_COMMANDS on)
9-
10-
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
11-
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/dist" CACHE PATH "Install path prefix" FORCE)
12-
endif()
13-
14-
# Add ccache support
15-
option(EVC_ENABLE_CCACHE "Enable ccache for faster compilation" OFF)
16-
if(EVC_ENABLE_CCACHE)
17-
find_program(CCACHE_FOUND ccache)
18-
if(CCACHE_FOUND)
19-
message(STATUS "Using ccache: ${CCACHE_FOUND}")
20-
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_FOUND})
21-
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_FOUND})
22-
set(CMAKE_CUDA_COMPILER_LAUNCHER ${CCACHE_FOUND})
23-
else()
24-
message(WARNING "ccache not found but EVC_ENABLE_CCACHE was enabled")
25-
endif()
26-
endif()
27-
28-
include(FetchContent)
29-
30-
# Only fetch mqttc if it hasn't been fetched already
31-
if(NOT TARGET mqttc AND NOT DISABLE_EDM)
32-
FetchContent_Declare(
33-
mqttc
34-
GIT_REPOSITORY https://github.com/LiamBindle/MQTT-C.git
35-
GIT_TAG v1.1.6
36-
)
37-
FetchContent_MakeAvailable(mqttc)
38-
endif()
39-
401
option(BUILD_DOC "Build documentation" OFF)
412
option(BUILD_EXAMPLES "Build examples" OFF)
423

434
add_subdirectory(src)
445

456
if (BUILD_TESTING)
46-
include(CTest)
477
add_subdirectory(test)
488
endif()
499

lib/everest/io/src/CMakeLists.txt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ target_sources(everest_io
2828

2929
target_include_directories(everest_io
3030
PUBLIC
31-
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
31+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
3232
$<INSTALL_INTERFACE:include>
3333
)
3434

@@ -58,16 +58,10 @@ set_target_properties(everest_io
5858
)
5959

6060
install(
61-
TARGETS everest_io mqttc
62-
EXPORT everest_io-targets
61+
TARGETS everest_io
6362
)
6463

65-
evc_setup_package(
66-
NAME everest-io
67-
EXPORT everest_io-targets
68-
NAMESPACE everest
69-
)
70-
71-
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
64+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../include/everest
7265
DESTINATION include
66+
FILES_MATCHING PATTERN "*.hpp"
7367
)

lib/everest/tls/src/openssl_util.cpp

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -397,20 +397,9 @@ pkey_ptr load_private_key(const char* filename, const char* password) {
397397
* that causes key file to be opened an additional time
398398
*/
399399

400-
bool custom_key = false;
401-
402-
if (filename != nullptr) {
403-
fs::path keyfile{std::string(filename)};
404-
custom_key = evse_security::is_custom_private_key_file(keyfile);
405-
}
406-
407-
OpenSSLProvider provider;
408-
409-
if (custom_key) {
410-
// set global provider to custom settings
411-
provider.set_global_mode(OpenSSLProvider::mode_t::custom_provider);
412-
} else {
413-
provider.set_global_mode(OpenSSLProvider::mode_t::default_provider);
400+
{
401+
OpenSSLProvider provider; // ensure providers are loaded
402+
// minimise holding the mutex
414403
}
415404

416405
pkey_ptr private_key{nullptr, nullptr};
@@ -425,11 +414,6 @@ pkey_ptr load_private_key(const char* filename, const char* password) {
425414
BIO_free(bio);
426415
}
427416

428-
if (custom_key) {
429-
// reset global provider back to default settings
430-
provider.set_global_mode(OpenSSLProvider::mode_t::default_provider);
431-
}
432-
433417
return private_key;
434418
}
435419

lib/everest/tls/src/tls.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,6 @@ bool configure_ssl_ctx(bool is_server, SSL_CTX*& ctx, const char* ciphersuites,
421421
const tls::Server::certificate_config_t& cert_config, bool required) {
422422
bool result{true};
423423

424-
// TPM2 support is via the OpenSSL provider class OpenSSLProvider in
425-
// libevse-security. This needs to be performed before
426-
// SSL_CTX_use_PrivateKey_file() or configure_ssl_ctx() is called
427-
428424
if (is_server) {
429425
bool custom_key = false;
430426

@@ -435,16 +431,8 @@ bool configure_ssl_ctx(bool is_server, SSL_CTX*& ctx, const char* ciphersuites,
435431

436432
OpenSSLProvider provider;
437433

438-
provider.set_global_mode(OpenSSLProvider::mode_t::default_provider);
439-
440-
if (custom_key) {
441-
provider.set_tls_mode(OpenSSLProvider::mode_t::custom_provider);
442-
} else {
443-
provider.set_tls_mode(OpenSSLProvider::mode_t::default_provider);
444-
}
445-
446434
const SSL_METHOD* method = TLS_server_method();
447-
ctx = SSL_CTX_new_ex(provider, provider.propquery_tls_str(), method);
435+
ctx = SSL_CTX_new_ex(provider, provider.propquery_default(), method);
448436
} else {
449437
const SSL_METHOD* method = TLS_client_method();
450438
ctx = SSL_CTX_new(method);
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest
3+
#include "BUDCExternalDerate.hpp"
4+
#include "ftxui/component/component.hpp"
5+
#include "ftxui/component/component_base.hpp"
6+
#include "ftxui/component/component_options.hpp"
7+
#include "ftxui/component/event.hpp"
8+
#include "ftxui/component/screen_interactive.hpp"
9+
#include "ftxui/dom/elements.hpp"
10+
#include "ftxui/screen/color.hpp"
11+
#include <regex>
12+
#include <string>
13+
14+
namespace module {
15+
16+
using namespace ftxui;
17+
18+
void BUDCExternalDerate::init() {
19+
invoke_init(*p_main);
20+
}
21+
22+
void BUDCExternalDerate::ready() {
23+
invoke_ready(*p_main);
24+
25+
auto screen = ScreenInteractive::Fullscreen();
26+
27+
auto msg_component = Container::Vertical({Renderer([] { return text(""); })});
28+
29+
std::map<std::string, std::map<std::string, Component>> messages;
30+
31+
r_derate->subscribe_all_errors(
32+
[&](Everest::error::Error const& error) {
33+
std::scoped_lock lock(data_mutex);
34+
auto error_elem = Renderer([=] { return text(" - " + error.type); });
35+
auto sub_elem = Renderer([=] { return text(" " + error.sub_type); });
36+
auto msg_elem = Renderer([=] { return text(" " + error.message); });
37+
38+
auto component = Container::Vertical({
39+
error_elem,
40+
sub_elem,
41+
msg_elem,
42+
});
43+
44+
messages[error.type][error.sub_type] = component;
45+
msg_component->Add(component);
46+
screen.Post(Event::Custom);
47+
},
48+
[&](Everest::error::Error const& error) {
49+
std::scoped_lock lock(data_mutex);
50+
if (messages.count(error.type)) {
51+
auto& sub = messages.at(error.type);
52+
if (sub.count(error.sub_type)) {
53+
auto& elem = sub.at(error.sub_type);
54+
elem->Detach();
55+
sub.erase(error.sub_type);
56+
}
57+
if (not sub.size()) {
58+
messages.erase(error.type);
59+
}
60+
}
61+
screen.Post(Event::Custom);
62+
});
63+
64+
auto msg_component_holder = Container::Horizontal({msg_component});
65+
66+
auto msg_component_renderer = Renderer(msg_component_holder, [&] {
67+
auto win = window(text("Active Errors"), msg_component_holder->Render());
68+
return vbox({
69+
hbox({
70+
win,
71+
}),
72+
}) |
73+
flex_grow;
74+
});
75+
76+
auto var_component =
77+
Container::Vertical({Renderer([&] { return text("plug_temperature_C: " + std::to_string(plug_temp_C)); })});
78+
auto var_component_holder = Container::Horizontal({var_component});
79+
auto var_component_renderer = Renderer(var_component_holder, [&] {
80+
auto win = window(text("Vars"), var_component_holder->Render());
81+
return vbox({
82+
hbox({
83+
win,
84+
}),
85+
}) |
86+
flex_grow;
87+
});
88+
89+
r_derate->subscribe_plug_temperature_C([&](double temp) {
90+
std::scoped_lock lock(data_mutex);
91+
plug_temp_C = temp;
92+
screen.Post(Event::Custom);
93+
});
94+
95+
InputOption o;
96+
o.multiline = false;
97+
o.cursor_position = 0;
98+
99+
auto max_export_current_A_input = Input(&max_export_current_A, "100.0", o);
100+
auto max_import_current_A_input = Input(&max_import_current_A, "200.0", o);
101+
auto max_export_power_W_input = Input(&max_export_power_W, "300.0", o);
102+
auto max_import_power_W_input = Input(&max_import_power_W, "400.0", o);
103+
104+
Component ovm_start = Button(
105+
"Set",
106+
[&] {
107+
types::dc_external_derate::ExternalDerating val;
108+
val.max_export_current_A = std::stof(max_export_current_A);
109+
val.max_import_current_A = std::stof(max_import_current_A);
110+
val.max_export_power_W = std::stof(max_export_power_W);
111+
val.max_import_power_W = std::stof(max_import_power_W);
112+
r_derate->call_set_external_derating(val);
113+
},
114+
ButtonOption::Animated(Color::Blue, Color::White, Color::BlueLight, Color::White)) |
115+
flex_grow;
116+
117+
auto action_component = Container::Horizontal({
118+
Container::Vertical({
119+
max_export_current_A_input,
120+
max_import_current_A_input,
121+
max_export_power_W_input,
122+
max_import_power_W_input,
123+
ovm_start,
124+
}),
125+
});
126+
127+
auto action_component_renderer = Renderer(action_component, [&] {
128+
return vbox({hbox(ovm_start->Render()),
129+
130+
vbox(hbox(text(" Max Export Current (A): "), max_export_current_A_input->Render()),
131+
hbox(text(" Max Import Current (A): "), max_import_current_A_input->Render()),
132+
hbox(text(" Max Export Power (W): "), max_export_power_W_input->Render()),
133+
hbox(text(" Max Import Power (W): "), max_import_power_W_input->Render()))});
134+
});
135+
136+
auto action_renderer = Renderer(action_component, [&] {
137+
return vbox({
138+
hbox({
139+
window(text("DC External Derate Commands"), action_component_renderer->Render()),
140+
}),
141+
}) |
142+
flex_grow;
143+
});
144+
145+
auto main_container = Container::Horizontal({action_renderer, var_component_renderer, msg_component_renderer});
146+
147+
auto main_renderer = Renderer(main_container, [&] {
148+
std::scoped_lock lock(data_mutex);
149+
return vbox({
150+
text("DC External Derate Bringup") | bold | hcenter,
151+
hbox({main_container->Render()}),
152+
});
153+
});
154+
155+
screen.Loop(main_renderer);
156+
}
157+
158+
} // namespace module

0 commit comments

Comments
 (0)