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:
@@ -0,0 +1,84 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2020 - 2026 Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include "BUTokenProvider.hpp"
|
||||
#include "ftxui/component/component.hpp"
|
||||
#include "ftxui/component/screen_interactive.hpp"
|
||||
#include "ftxui/dom/table.hpp"
|
||||
|
||||
namespace module {
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
static std::vector<std::vector<std::string>> to_table(types::authorization::ProvidedIdToken t) {
|
||||
std::vector<std::vector<std::string>> token;
|
||||
token.push_back({"Protocol", fmt::format("{}:", id_token_type_to_string(t.id_token.type))});
|
||||
token.push_back({"UID", fmt::format("{}", t.id_token.value)});
|
||||
|
||||
std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||
std::tm* p_tm = std::localtime(&now);
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << std::put_time(p_tm, "%Y-%m-%d %H:%M:%S");
|
||||
|
||||
token.push_back({"Timestamp", oss.str()});
|
||||
return token;
|
||||
}
|
||||
|
||||
void BUTokenProvider::init() {
|
||||
types::authorization::ProvidedIdToken t;
|
||||
t.id_token.type = types::authorization::IdTokenType::NoAuthorization;
|
||||
t.id_token.value = std::string("0");
|
||||
last_token = to_table(t);
|
||||
}
|
||||
|
||||
void BUTokenProvider::ready() {
|
||||
auto screen = ScreenInteractive::Fullscreen();
|
||||
|
||||
r_token_provider->subscribe_provided_token([this, &screen](const types::authorization::ProvidedIdToken t) {
|
||||
std::scoped_lock lock(data_mutex);
|
||||
last_token = to_table(t);
|
||||
screen.Post(Event::Custom);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Vars
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
auto vars_renderer = Renderer([&] {
|
||||
std::vector<std::vector<std::string>> table_content;
|
||||
{
|
||||
std::scoped_lock lock(data_mutex);
|
||||
table_content = last_token;
|
||||
}
|
||||
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"), vars.Render()),
|
||||
}),
|
||||
}) |
|
||||
flex_grow;
|
||||
});
|
||||
|
||||
auto main_container = Container::Horizontal({
|
||||
vars_renderer,
|
||||
});
|
||||
|
||||
auto main_renderer = Renderer(main_container, [&] {
|
||||
return vbox({
|
||||
text("NFC Token Provider") | bold | hcenter,
|
||||
main_container->Render(),
|
||||
});
|
||||
});
|
||||
|
||||
screen.Loop(main_renderer);
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
@@ -0,0 +1,60 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2020 - 2026 Pionix GmbH and Contributors to EVerest
|
||||
#ifndef BUTOKEN_PROVIDER_HPP
|
||||
#define BUTOKEN_PROVIDER_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for required interface implementations
|
||||
#include <generated/interfaces/auth_token_provider/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 BUTokenProvider : public Everest::ModuleBase {
|
||||
public:
|
||||
BUTokenProvider() = delete;
|
||||
BUTokenProvider(const ModuleInfo& info, std::unique_ptr<auth_token_providerIntf> r_token_provider, Conf& config) :
|
||||
ModuleBase(info), r_token_provider(std::move(r_token_provider)), config(config){};
|
||||
|
||||
const std::unique_ptr<auth_token_providerIntf> r_token_provider;
|
||||
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::vector<std::vector<std::string>> last_token;
|
||||
// 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 // BUTOKEN_PROVIDER_HPP
|
||||
@@ -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 Token Provider interface
|
||||
requires:
|
||||
token_provider:
|
||||
interface: auth_token_provider
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Christoph Burandt
|
||||
Reference in New Issue
Block a user