Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter
- CitrineOS core extracted (CSMS OCPP 2.0.1) - OpenOCPP extracted (firmware OCPP 1.6J/2.0.1) - ShapeShifter library installed (pip install -e) - ShapeShifter specification extracted - EVerest extracted TODO updated with progress
This commit is contained in:
202
tools/EVerest-main/modules/BringUp/BUSystem/BUSystem.cpp
Normal file
202
tools/EVerest-main/modules/BringUp/BUSystem/BUSystem.cpp
Normal file
@@ -0,0 +1,202 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2020 - 2026 Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include "BUSystem.hpp"
|
||||
#include "ftxui/component/component.hpp"
|
||||
#include "ftxui/component/screen_interactive.hpp"
|
||||
#include "ftxui/dom/table.hpp"
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
namespace module {
|
||||
|
||||
void BUSystem::init() {
|
||||
}
|
||||
|
||||
void BUSystem::ready() {
|
||||
auto screen = ScreenInteractive::Fullscreen();
|
||||
|
||||
r_system->subscribe_firmware_update_status([this, &screen](const types::system::FirmwareUpdateStatus fus) {
|
||||
firmware_update_status = types::system::firmware_update_status_enum_to_string(fus.firmware_update_status);
|
||||
screen.Post(Event::Custom);
|
||||
});
|
||||
|
||||
r_system->subscribe_log_status([this, &screen](const types::system::LogStatus ls) {
|
||||
log_status = types::system::log_status_enum_to_string(ls.log_status);
|
||||
screen.Post(Event::Custom);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Commands that can be sent over System interface
|
||||
// ---------------------------------------------------------------------------
|
||||
Component allow_firmware_installation_button = Button(
|
||||
"Allow update",
|
||||
[&] {
|
||||
last_command = "Allow update";
|
||||
r_system->call_allow_firmware_installation();
|
||||
},
|
||||
ButtonOption::Animated(Color::Blue, Color::White, Color::RedLight, Color::White));
|
||||
|
||||
Component get_reset_allowed_button = Button(
|
||||
"Is reset allowed",
|
||||
[&] {
|
||||
last_command = "Is reset allowed";
|
||||
auto allowed = r_system->call_is_reset_allowed(types::system::ResetType::Soft);
|
||||
is_reset_allowed = (allowed) ? "true" : "false";
|
||||
},
|
||||
ButtonOption::Animated(Color::Blue, Color::White, Color::RedLight, Color::White));
|
||||
|
||||
Component reset_button = Button(
|
||||
"Reset",
|
||||
[&] {
|
||||
last_command = "Reset";
|
||||
types::system::ResetType type = types::system::ResetType::Soft;
|
||||
bool scheduled = false;
|
||||
r_system->call_reset(type, scheduled);
|
||||
},
|
||||
ButtonOption::Animated(Color::Blue, Color::White, Color::RedLight, Color::White));
|
||||
|
||||
Component get_boot_reason_button = Button(
|
||||
"Get boot reason",
|
||||
[&] {
|
||||
last_command = "Get boot reason";
|
||||
auto reason = r_system->call_get_boot_reason();
|
||||
boot_reason = types::system::boot_reason_to_string(reason);
|
||||
},
|
||||
ButtonOption::Animated(Color::Blue, Color::White, Color::RedLight, Color::White));
|
||||
|
||||
auto cmds_component = Container::Horizontal({
|
||||
allow_firmware_installation_button,
|
||||
get_reset_allowed_button,
|
||||
reset_button,
|
||||
get_boot_reason_button,
|
||||
});
|
||||
|
||||
auto cmds_renderer = Renderer(cmds_component, [&] {
|
||||
auto cmds_win = window(text("Commands"), cmds_component->Render());
|
||||
return vbox({
|
||||
hbox({cmds_win}) | center,
|
||||
separator(),
|
||||
}) |
|
||||
flex_grow;
|
||||
});
|
||||
|
||||
auto log_location = Input(&log_upload_location, "Upload location");
|
||||
Component log_button = Button(
|
||||
"Upload logs",
|
||||
[&] {
|
||||
last_command = "Upload logs";
|
||||
types::system::UploadLogsRequest ulr;
|
||||
ulr.location = log_upload_location;
|
||||
ulr.retries = 1;
|
||||
ulr.retry_interval_s = 1;
|
||||
auto result = r_system->call_upload_logs(ulr);
|
||||
upload_logs_status =
|
||||
fmt::format("Upload status:{}", upload_logs_status_to_string(result.upload_logs_status));
|
||||
},
|
||||
ButtonOption::Animated(Color::Blue, Color::White, Color::RedLight, Color::White));
|
||||
|
||||
auto log_container = Container::Horizontal({
|
||||
log_location,
|
||||
log_button,
|
||||
});
|
||||
|
||||
auto input_log_renderer = Renderer(log_container, [&] {
|
||||
return vbox({
|
||||
hbox(text(" Upload logs URL : "), log_location->Render(), log_button->Render()),
|
||||
}) |
|
||||
flex_grow;
|
||||
});
|
||||
|
||||
auto input_time = Input(&new_system_time, "New system time in RFC3339 format");
|
||||
Component time_button = Button(
|
||||
"Set system time",
|
||||
[&] {
|
||||
auto result = r_system->call_set_system_time(new_system_time);
|
||||
last_command = (result) ? "Set system time - successful" : "Set system time - unsuccessful";
|
||||
},
|
||||
ButtonOption::Animated(Color::Blue, Color::White, Color::RedLight, Color::White));
|
||||
auto input_time_container = Container::Horizontal({
|
||||
input_time,
|
||||
time_button,
|
||||
});
|
||||
|
||||
auto input_time_renderer = Renderer(input_time_container, [&] {
|
||||
return vbox({
|
||||
hbox(text(" New system time : "), input_time->Render(), time_button->Render()),
|
||||
}) |
|
||||
flex_grow;
|
||||
});
|
||||
|
||||
auto input_address = Input(&firmware_update_url, "URL where to take the update from");
|
||||
Component update_button = Button(
|
||||
"Update firmware",
|
||||
[&] {
|
||||
last_command = "Update";
|
||||
types::system::FirmwareUpdateRequest fur;
|
||||
fur.request_id = 1;
|
||||
fur.location = firmware_update_url;
|
||||
auto result = r_system->call_update_firmware(fur);
|
||||
update_firmware_response = update_firmware_response_to_string(result);
|
||||
},
|
||||
ButtonOption::Animated(Color::Blue, Color::White, Color::RedLight, Color::White));
|
||||
auto input_container = Container::Horizontal({
|
||||
input_address,
|
||||
update_button,
|
||||
});
|
||||
|
||||
auto input_renderer = Renderer(input_container, [&] {
|
||||
return vbox({
|
||||
hbox(text(" URL of the update : "), input_address->Render(), update_button->Render()),
|
||||
}) |
|
||||
flex_grow;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Vars
|
||||
// ---------------------------------------------------------------------------
|
||||
auto vars_renderer = Renderer([&] {
|
||||
Element last_command_element = text("Last command: " + last_command);
|
||||
std::vector<std::vector<std::string>> table_content;
|
||||
{
|
||||
// std::scoped_lock lock(data_mutex);
|
||||
table_content = {{"Firmware update status", firmware_update_status},
|
||||
{"Firmware update response", update_firmware_response},
|
||||
{"Get boot reason", boot_reason},
|
||||
{"Upload log status", upload_logs_status},
|
||||
{"Log status", log_status},
|
||||
{"Is reset allowed", is_reset_allowed}};
|
||||
}
|
||||
auto vars = Table(table_content);
|
||||
|
||||
vars.SelectColumn(0).Border(LIGHT);
|
||||
for (int i = 0; i < table_content.size(); i++) {
|
||||
vars.SelectRow(i).Border(LIGHT);
|
||||
}
|
||||
return vbox({
|
||||
hbox({
|
||||
window(text("Information"), vbox({text("Last command: " + last_command), vars.Render()})),
|
||||
}) | center,
|
||||
}) |
|
||||
flex_grow;
|
||||
});
|
||||
|
||||
auto main_container = Container::Vertical({
|
||||
input_renderer,
|
||||
input_time_renderer,
|
||||
input_log_renderer,
|
||||
cmds_renderer,
|
||||
vars_renderer,
|
||||
});
|
||||
|
||||
auto main_renderer = Renderer(main_container, [&] {
|
||||
return vbox({
|
||||
text("System Component") | bold | hcenter,
|
||||
main_container->Render(),
|
||||
});
|
||||
});
|
||||
|
||||
screen.Loop(main_renderer);
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
68
tools/EVerest-main/modules/BringUp/BUSystem/BUSystem.hpp
Normal file
68
tools/EVerest-main/modules/BringUp/BUSystem/BUSystem.hpp
Normal file
@@ -0,0 +1,68 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2020 - 2026 Pionix GmbH and Contributors to EVerest
|
||||
#ifndef BUSYSTEM_HPP
|
||||
#define BUSYSTEM_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for required interface implementations
|
||||
#include <generated/interfaces/system/Interface.hpp>
|
||||
|
||||
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1
|
||||
// insert your custom include headers here
|
||||
// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1
|
||||
|
||||
namespace module {
|
||||
|
||||
struct Conf {};
|
||||
|
||||
class BUSystem : public Everest::ModuleBase {
|
||||
public:
|
||||
BUSystem() = delete;
|
||||
BUSystem(const ModuleInfo& info, std::unique_ptr<systemIntf> r_system, Conf& config) :
|
||||
ModuleBase(info), r_system(std::move(r_system)), config(config){};
|
||||
|
||||
const std::unique_ptr<systemIntf> r_system;
|
||||
const Conf& config;
|
||||
|
||||
// ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1
|
||||
// insert your public definitions here
|
||||
// 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
|
||||
std::string last_command;
|
||||
std::string firmware_update_status;
|
||||
std::string log_status;
|
||||
std::string is_reset_allowed;
|
||||
std::string boot_reason;
|
||||
std::string firmware_update_url;
|
||||
std::string new_system_time;
|
||||
std::string log_upload_location;
|
||||
std::string upload_logs_status;
|
||||
std::string update_firmware_response;
|
||||
// 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 // BUSYSTEM_HPP
|
||||
21
tools/EVerest-main/modules/BringUp/BUSystem/CMakeLists.txt
Normal file
21
tools/EVerest-main/modules/BringUp/BUSystem/CMakeLists.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# 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
|
||||
target_link_libraries(${MODULE_NAME}
|
||||
PRIVATE ftxui::screen
|
||||
PRIVATE ftxui::dom
|
||||
PRIVATE ftxui::component
|
||||
)
|
||||
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
|
||||
|
||||
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
|
||||
# insert other things like install cmds etc here
|
||||
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
|
||||
@@ -0,0 +1,8 @@
|
||||
description: Interactive bring up helper for System component
|
||||
requires:
|
||||
system:
|
||||
interface: system
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Florin Mihut
|
||||
Reference in New Issue
Block a user