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:
145
tools/EVerest-main/modules/BringUp/BUSlac/BUSlac.cpp
Normal file
145
tools/EVerest-main/modules/BringUp/BUSlac/BUSlac.cpp
Normal file
@@ -0,0 +1,145 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#include "BUSlac.hpp"
|
||||
|
||||
#include "ftxui/dom/table.hpp"
|
||||
#include <ftxui/component/component.hpp>
|
||||
#include <ftxui/component/screen_interactive.hpp>
|
||||
#include <ftxui/dom/elements.hpp>
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
namespace module {
|
||||
|
||||
void BUSlac::init() {
|
||||
}
|
||||
|
||||
void BUSlac::ready() {
|
||||
auto screen = ScreenInteractive::Fullscreen();
|
||||
|
||||
r_slac->subscribe_state([this, &screen](const types::slac::State new_state) {
|
||||
{
|
||||
std::scoped_lock lock(data_mutex);
|
||||
state = types::slac::state_to_string(new_state);
|
||||
}
|
||||
screen.PostEvent(Event::Custom);
|
||||
});
|
||||
|
||||
r_slac->subscribe_dlink_ready([this, &screen](const bool& is_ready) {
|
||||
{
|
||||
std::scoped_lock lock(data_mutex);
|
||||
dlink = is_ready ? "true" : "false";
|
||||
}
|
||||
screen.PostEvent(Event::Custom);
|
||||
});
|
||||
|
||||
r_slac->subscribe_request_error_routine([this, &screen]() {
|
||||
{
|
||||
std::scoped_lock lock(data_mutex);
|
||||
last_request_error_routine_timestamp = std::to_string(
|
||||
std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch())
|
||||
.count());
|
||||
}
|
||||
screen.PostEvent(Event::Custom);
|
||||
});
|
||||
|
||||
r_slac->subscribe_ev_mac_address([this, &screen](const std::string& mac) {
|
||||
{
|
||||
std::scoped_lock lock(data_mutex);
|
||||
ev_mac_address = mac;
|
||||
}
|
||||
screen.PostEvent(Event::Custom);
|
||||
});
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Left column (Var Display)
|
||||
// -------------------------------------------------------------------
|
||||
auto data_renderer = Renderer([&] {
|
||||
std::vector<std::vector<std::string>> table_content;
|
||||
|
||||
{
|
||||
std::scoped_lock lock(data_mutex);
|
||||
table_content = {
|
||||
{"State", state},
|
||||
{"DLink Ready", dlink},
|
||||
{"Last Request Error Routine", last_request_error_routine_timestamp},
|
||||
{"EV MAC Address", ev_mac_address},
|
||||
};
|
||||
}
|
||||
|
||||
auto table = Table(table_content);
|
||||
|
||||
table.SelectAll().Border(LIGHT);
|
||||
table.SelectColumn(0).Border(LIGHT);
|
||||
for (int i = 0; i < (int)table_content.size(); ++i)
|
||||
table.SelectRow(i).Border(LIGHT);
|
||||
|
||||
return vbox({
|
||||
window(text("Module Data"), vbox({
|
||||
table.Render(),
|
||||
})) |
|
||||
size(WIDTH, EQUAL, 40),
|
||||
}) |
|
||||
flex_grow;
|
||||
});
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Right column (Command Buttons)
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
auto button_start_slac = Button("Start SLAC", [&] { r_slac->call_reset(true); });
|
||||
auto button_stop_slac = Button("Stop SLAC", [&] { r_slac->call_reset(false); });
|
||||
auto button_enter_bcd = Button("Enter BCD", [&] { r_slac->call_enter_bcd(); });
|
||||
auto button_leave_bcd = Button("Leave BCD", [&] { r_slac->call_leave_bcd(); });
|
||||
auto button_dlink_terminate = Button("DLink Terminate", [&] { r_slac->call_dlink_terminate(); });
|
||||
auto button_dlink_error = Button("DLink Error", [&] { r_slac->call_dlink_error(); });
|
||||
auto button_dlink_pause = Button("DLink Pause", [&] { r_slac->call_dlink_pause(); });
|
||||
|
||||
// Compose the command panel layout
|
||||
auto command_container = Container::Vertical({
|
||||
Container::Horizontal({button_start_slac, button_stop_slac}),
|
||||
button_enter_bcd,
|
||||
button_leave_bcd,
|
||||
button_dlink_terminate,
|
||||
button_dlink_error,
|
||||
button_dlink_pause,
|
||||
});
|
||||
|
||||
auto command_renderer = Renderer(command_container, [&] {
|
||||
return vbox({
|
||||
text("Commands") | bold | center,
|
||||
separator(),
|
||||
button_start_slac->Render(),
|
||||
button_stop_slac->Render(),
|
||||
button_enter_bcd->Render(),
|
||||
button_leave_bcd->Render(),
|
||||
button_dlink_terminate->Render(),
|
||||
button_dlink_error->Render(),
|
||||
button_dlink_pause->Render(),
|
||||
}) |
|
||||
border | size(WIDTH, EQUAL, 40);
|
||||
});
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Combine columns
|
||||
// -------------------------------------------------------------------
|
||||
auto layout = Container::Horizontal({
|
||||
data_renderer,
|
||||
command_renderer,
|
||||
});
|
||||
|
||||
auto main_renderer = Renderer(layout, [&] {
|
||||
return vbox({
|
||||
text("SLAC BringUp") | bold | center,
|
||||
separator(),
|
||||
hbox({
|
||||
data_renderer->Render(),
|
||||
command_renderer->Render(),
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
screen.Loop(main_renderer);
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
63
tools/EVerest-main/modules/BringUp/BUSlac/BUSlac.hpp
Normal file
63
tools/EVerest-main/modules/BringUp/BUSlac/BUSlac.hpp
Normal file
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef BUSLAC_HPP
|
||||
#define BUSLAC_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for required interface implementations
|
||||
#include <generated/interfaces/slac/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 BUSlac : public Everest::ModuleBase {
|
||||
public:
|
||||
BUSlac() = delete;
|
||||
BUSlac(const ModuleInfo& info, std::unique_ptr<slacIntf> r_slac, Conf& config) :
|
||||
ModuleBase(info), r_slac(std::move(r_slac)), config(config){};
|
||||
|
||||
const std::unique_ptr<slacIntf> r_slac;
|
||||
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::mutex data_mutex;
|
||||
std::string state;
|
||||
std::string dlink;
|
||||
std::string last_request_error_routine_timestamp;
|
||||
std::string ev_mac_address;
|
||||
// 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 // BUSLAC_HPP
|
||||
21
tools/EVerest-main/modules/BringUp/BUSlac/CMakeLists.txt
Normal file
21
tools/EVerest-main/modules/BringUp/BUSlac/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
|
||||
8
tools/EVerest-main/modules/BringUp/BUSlac/manifest.yaml
Normal file
8
tools/EVerest-main/modules/BringUp/BUSlac/manifest.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
description: Interactive bring up helper for SLAC interface
|
||||
requires:
|
||||
slac:
|
||||
interface: slac
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Piet Gömpel
|
||||
Reference in New Issue
Block a user