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:
6
tools/EVerest-main/modules/Testing/CMakeLists.txt
Normal file
6
tools/EVerest-main/modules/Testing/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
ev_add_module(DummyBankSessionTokenProvider)
|
||||
ev_add_module(DummySessionCostProvider)
|
||||
ev_add_module(DummyTokenProvider)
|
||||
ev_add_module(DummyTokenProviderManual)
|
||||
ev_add_module(DummyTokenValidator)
|
||||
ev_add_module(DummyV2G)
|
||||
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# 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
|
||||
everest::helpers
|
||||
)
|
||||
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
|
||||
|
||||
target_sources(${MODULE_NAME}
|
||||
PRIVATE
|
||||
"main/bank_session_token_providerImpl.cpp"
|
||||
)
|
||||
|
||||
# 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,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#include "DummyBankSessionTokenProvider.hpp"
|
||||
|
||||
namespace module {
|
||||
|
||||
void DummyBankSessionTokenProvider::init() {
|
||||
invoke_init(*p_main);
|
||||
}
|
||||
|
||||
void DummyBankSessionTokenProvider::ready() {
|
||||
invoke_ready(*p_main);
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
@@ -0,0 +1,59 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef DUMMY_BANK_SESSION_TOKEN_PROVIDER_HPP
|
||||
#define DUMMY_BANK_SESSION_TOKEN_PROVIDER_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for provided interface implementations
|
||||
#include <generated/interfaces/bank_session_token_provider/Implementation.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 DummyBankSessionTokenProvider : public Everest::ModuleBase {
|
||||
public:
|
||||
DummyBankSessionTokenProvider() = delete;
|
||||
DummyBankSessionTokenProvider(const ModuleInfo& info, std::unique_ptr<bank_session_token_providerImplBase> p_main,
|
||||
Conf& config) :
|
||||
ModuleBase(info), p_main(std::move(p_main)), config(config){};
|
||||
|
||||
const std::unique_ptr<bank_session_token_providerImplBase> p_main;
|
||||
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
|
||||
// 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 // DUMMY_BANK_SESSION_TOKEN_PROVIDER_HPP
|
||||
@@ -0,0 +1,28 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include "bank_session_token_providerImpl.hpp"
|
||||
|
||||
#include <everest/helpers/helpers.hpp>
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
void bank_session_token_providerImpl::init() {
|
||||
}
|
||||
|
||||
void bank_session_token_providerImpl::ready() {
|
||||
}
|
||||
|
||||
types::payment_terminal::BankSessionToken bank_session_token_providerImpl::handle_get_bank_session_token() {
|
||||
types::payment_terminal::BankSessionToken bank_session_token;
|
||||
bank_session_token.token = config.token;
|
||||
|
||||
if (config.randomize) {
|
||||
bank_session_token.token = everest::helpers::get_uuid();
|
||||
}
|
||||
return bank_session_token;
|
||||
}
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
@@ -0,0 +1,65 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef MAIN_BANK_SESSION_TOKEN_PROVIDER_IMPL_HPP
|
||||
#define MAIN_BANK_SESSION_TOKEN_PROVIDER_IMPL_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 3
|
||||
//
|
||||
|
||||
#include <generated/interfaces/bank_session_token_provider/Implementation.hpp>
|
||||
|
||||
#include "../DummyBankSessionTokenProvider.hpp"
|
||||
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
// insert your custom include headers here
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
struct Conf {
|
||||
std::string token;
|
||||
bool randomize;
|
||||
};
|
||||
|
||||
class bank_session_token_providerImpl : public bank_session_token_providerImplBase {
|
||||
public:
|
||||
bank_session_token_providerImpl() = delete;
|
||||
bank_session_token_providerImpl(Everest::ModuleAdapter* ev,
|
||||
const Everest::PtrContainer<DummyBankSessionTokenProvider>& mod, Conf& config) :
|
||||
bank_session_token_providerImplBase(ev, "main"), mod(mod), config(config){};
|
||||
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
// insert your public definitions here
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
|
||||
protected:
|
||||
// command handler functions (virtual)
|
||||
virtual types::payment_terminal::BankSessionToken handle_get_bank_session_token() override;
|
||||
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
// insert your protected definitions here
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
|
||||
private:
|
||||
const Everest::PtrContainer<DummyBankSessionTokenProvider>& mod;
|
||||
const Conf& config;
|
||||
|
||||
virtual void init() override;
|
||||
virtual void ready() override;
|
||||
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
// insert your private definitions here
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
};
|
||||
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
// insert other definitions here
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
|
||||
#endif // MAIN_BANK_SESSION_TOKEN_PROVIDER_IMPL_HPP
|
||||
@@ -0,0 +1,20 @@
|
||||
description: Dummy bank session token provider
|
||||
provides:
|
||||
main:
|
||||
description: Main implementation of bank session dummy token provider either always returning one configured token or each time a real UUID
|
||||
interface: bank_session_token_provider
|
||||
config:
|
||||
token:
|
||||
description: Dummy token string to return
|
||||
type: string
|
||||
default: DummyBankSessionToken
|
||||
randomize:
|
||||
description: Randomize token string to return
|
||||
type: boolean
|
||||
default: false
|
||||
requires: {}
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Kai-Uwe Hermann
|
||||
- Christoph Burandt
|
||||
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# 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
|
||||
everest::helpers
|
||||
)
|
||||
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
|
||||
|
||||
target_sources(${MODULE_NAME}
|
||||
PRIVATE
|
||||
"main/session_costImpl.cpp"
|
||||
)
|
||||
|
||||
# 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,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#include "DummySessionCostProvider.hpp"
|
||||
|
||||
namespace module {
|
||||
|
||||
void DummySessionCostProvider::init() {
|
||||
invoke_init(*p_main);
|
||||
}
|
||||
|
||||
void DummySessionCostProvider::ready() {
|
||||
invoke_ready(*p_main);
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
@@ -0,0 +1,58 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef DUMMY_SESSION_COST_PROVIDER_HPP
|
||||
#define DUMMY_SESSION_COST_PROVIDER_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for provided interface implementations
|
||||
#include <generated/interfaces/session_cost/Implementation.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 DummySessionCostProvider : public Everest::ModuleBase {
|
||||
public:
|
||||
DummySessionCostProvider() = delete;
|
||||
DummySessionCostProvider(const ModuleInfo& info, std::unique_ptr<session_costImplBase> p_main, Conf& config) :
|
||||
ModuleBase(info), p_main(std::move(p_main)), config(config){};
|
||||
|
||||
const std::unique_ptr<session_costImplBase> p_main;
|
||||
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
|
||||
// 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 // DUMMY_SESSION_COST_PROVIDER_HPP
|
||||
@@ -0,0 +1,89 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include "session_costImpl.hpp"
|
||||
|
||||
#include <everest/helpers/helpers.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#include <utils/date.hpp>
|
||||
|
||||
namespace {
|
||||
std::string format_uint(uint32_t value) {
|
||||
std::stringstream ss;
|
||||
ss << std::setw(4) << std::setfill('0') << value;
|
||||
return ss.str();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
void session_costImpl::init() {
|
||||
}
|
||||
|
||||
void session_costImpl::ready() {
|
||||
types::session_cost::TariffMessage tariff_message;
|
||||
types::session_cost::SessionCost session_cost;
|
||||
|
||||
tariff_message.identifier_type = types::display_message::IdentifierType::IdToken;
|
||||
|
||||
const std::string msg_content_en = "Tariff Message content no. ";
|
||||
const std::string msg_content_de = "Tariff Message Inhalt Nr. ";
|
||||
|
||||
session_cost.currency = types::money::Currency{.code = {types::money::CurrencyCode::EUR}, .decimals = 2};
|
||||
|
||||
while (true) {
|
||||
msg_count++;
|
||||
|
||||
tariff_message.messages.emplace_back(types::text_message::MessageContent{
|
||||
.content = msg_content_en + format_uint(msg_count), .language = std::string{"EN"}});
|
||||
tariff_message.messages.emplace_back(types::text_message::MessageContent{
|
||||
.content = msg_content_de + format_uint(msg_count), .language = std::string{"DE"}});
|
||||
|
||||
tariff_message.ocpp_transaction_id = everest::helpers::get_base64_uuid();
|
||||
tariff_message.identifier_id = everest::helpers::get_base64_id();
|
||||
|
||||
session_cost.session_id = format_uint(msg_count);
|
||||
switch (msg_count % 3) {
|
||||
case 0:
|
||||
session_cost.status = types::session_cost::SessionStatus::Running;
|
||||
break;
|
||||
case 1:
|
||||
session_cost.status = types::session_cost::SessionStatus::Idle;
|
||||
break;
|
||||
case 2:
|
||||
session_cost.status = types::session_cost::SessionStatus::Finished;
|
||||
break;
|
||||
}
|
||||
|
||||
auto now = date::utc_clock::now();
|
||||
auto past = now - std::chrono::hours(3);
|
||||
|
||||
auto now_datetime = Everest::Date::to_rfc3339(now);
|
||||
auto past_datetime = Everest::Date::to_rfc3339(past);
|
||||
|
||||
session_cost.cost_chunks.emplace({types::session_cost::SessionCostChunk{.timestamp_from = past_datetime,
|
||||
.timestamp_to = now_datetime,
|
||||
.metervalue_from = {54321},
|
||||
.metervalue_to = {71233}}});
|
||||
|
||||
EVLOG_info << "Publishing tariff message" << tariff_message;
|
||||
publish_tariff_message(tariff_message);
|
||||
EVLOG_info << "Publishing session cost" << session_cost;
|
||||
publish_session_cost(session_cost);
|
||||
|
||||
tariff_message.messages.pop_back();
|
||||
tariff_message.messages.pop_back();
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<int>(config.period_s * 1000)));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
@@ -0,0 +1,65 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef MAIN_SESSION_COST_IMPL_HPP
|
||||
#define MAIN_SESSION_COST_IMPL_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 3
|
||||
//
|
||||
|
||||
#include <generated/interfaces/session_cost/Implementation.hpp>
|
||||
|
||||
#include "../DummySessionCostProvider.hpp"
|
||||
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
// insert your custom include headers here
|
||||
#include <cstdint>
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
struct Conf {
|
||||
int period_s;
|
||||
};
|
||||
|
||||
class session_costImpl : public session_costImplBase {
|
||||
public:
|
||||
session_costImpl() = delete;
|
||||
session_costImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<DummySessionCostProvider>& mod,
|
||||
Conf& config) :
|
||||
session_costImplBase(ev, "main"), mod(mod), config(config){};
|
||||
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
// insert your public definitions here
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
|
||||
protected:
|
||||
// no commands defined for this interface
|
||||
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
// insert your protected definitions here
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
|
||||
private:
|
||||
const Everest::PtrContainer<DummySessionCostProvider>& mod;
|
||||
const Conf& config;
|
||||
|
||||
virtual void init() override;
|
||||
virtual void ready() override;
|
||||
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
// insert your private definitions here
|
||||
std::uint32_t msg_count{0};
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
};
|
||||
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
// insert other definitions here
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
|
||||
#endif // MAIN_SESSION_COST_IMPL_HPP
|
||||
@@ -0,0 +1,17 @@
|
||||
description: >-
|
||||
Dummy session cost provider to simplify testing of modules which require session_cost
|
||||
provides:
|
||||
main:
|
||||
description: Implementation of session_cost which periodically publishes new tariffs and session_costs
|
||||
interface: session_cost
|
||||
config:
|
||||
period_s:
|
||||
description: Period in which to publish (in s)
|
||||
type: integer
|
||||
minimum: 1
|
||||
maximum: 3600
|
||||
default: 5
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Christoph Burandt
|
||||
@@ -0,0 +1,9 @@
|
||||
load("//modules:module.bzl", "cc_everest_module")
|
||||
|
||||
cc_everest_module(
|
||||
name = "DummyTokenProvider",
|
||||
impls = ["main"],
|
||||
deps = [
|
||||
"//lib/everest/helpers",
|
||||
],
|
||||
)
|
||||
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# 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
|
||||
everest::helpers
|
||||
)
|
||||
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
|
||||
|
||||
target_sources(${MODULE_NAME}
|
||||
PRIVATE
|
||||
"main/auth_token_providerImpl.cpp"
|
||||
)
|
||||
|
||||
# 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,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#include "DummyTokenProvider.hpp"
|
||||
|
||||
namespace module {
|
||||
|
||||
void DummyTokenProvider::init() {
|
||||
invoke_init(*p_main);
|
||||
}
|
||||
|
||||
void DummyTokenProvider::ready() {
|
||||
invoke_ready(*p_main);
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef DUMMY_TOKEN_PROVIDER_HPP
|
||||
#define DUMMY_TOKEN_PROVIDER_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for provided interface implementations
|
||||
#include <generated/interfaces/auth_token_provider/Implementation.hpp>
|
||||
|
||||
// headers for required interface implementations
|
||||
#include <generated/interfaces/evse_manager/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 DummyTokenProvider : public Everest::ModuleBase {
|
||||
public:
|
||||
DummyTokenProvider() = delete;
|
||||
DummyTokenProvider(const ModuleInfo& info, std::unique_ptr<auth_token_providerImplBase> p_main,
|
||||
std::unique_ptr<evse_managerIntf> r_evse, Conf& config) :
|
||||
ModuleBase(info), p_main(std::move(p_main)), r_evse(std::move(r_evse)), config(config){};
|
||||
|
||||
const std::unique_ptr<auth_token_providerImplBase> p_main;
|
||||
const std::unique_ptr<evse_managerIntf> r_evse;
|
||||
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
|
||||
// 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 // DUMMY_TOKEN_PROVIDER_HPP
|
||||
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include "auth_token_providerImpl.hpp"
|
||||
|
||||
#include <everest/helpers/helpers.hpp>
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
void auth_token_providerImpl::init() {
|
||||
mod->r_evse->subscribe_session_event([this](types::evse_manager::SessionEvent event) {
|
||||
if (event.event == types::evse_manager::SessionEventEnum::SessionStarted) {
|
||||
types::authorization::ProvidedIdToken token;
|
||||
|
||||
token.id_token = {config.token, types::authorization::IdTokenType::ISO14443};
|
||||
token.authorization_type = types::authorization::string_to_authorization_type(config.type);
|
||||
if (config.connector_id > 0) {
|
||||
token.connectors.emplace({config.connector_id});
|
||||
}
|
||||
token.parent_id_token = {config.token, types::authorization::IdTokenType::ISO14443};
|
||||
|
||||
EVLOG_info << "Publishing new dummy token: " << everest::helpers::redact(token);
|
||||
publish_provided_token(token);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void auth_token_providerImpl::ready() {
|
||||
}
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
@@ -0,0 +1,66 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef MAIN_AUTH_TOKEN_PROVIDER_IMPL_HPP
|
||||
#define MAIN_AUTH_TOKEN_PROVIDER_IMPL_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 3
|
||||
//
|
||||
|
||||
#include <generated/interfaces/auth_token_provider/Implementation.hpp>
|
||||
|
||||
#include "../DummyTokenProvider.hpp"
|
||||
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
// insert your custom include headers here
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
struct Conf {
|
||||
std::string token;
|
||||
std::string type;
|
||||
double timeout;
|
||||
int connector_id;
|
||||
};
|
||||
|
||||
class auth_token_providerImpl : public auth_token_providerImplBase {
|
||||
public:
|
||||
auth_token_providerImpl() = delete;
|
||||
auth_token_providerImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<DummyTokenProvider>& mod,
|
||||
Conf& config) :
|
||||
auth_token_providerImplBase(ev, "main"), mod(mod), config(config){};
|
||||
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
// insert your public definitions here
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
|
||||
protected:
|
||||
// no commands defined for this interface
|
||||
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
// insert your protected definitions here
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
|
||||
private:
|
||||
const Everest::PtrContainer<DummyTokenProvider>& mod;
|
||||
const Conf& config;
|
||||
|
||||
virtual void init() override;
|
||||
virtual void ready() override;
|
||||
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
// insert your private definitions here
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
};
|
||||
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
// insert other definitions here
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
|
||||
#endif // MAIN_AUTH_TOKEN_PROVIDER_IMPL_HPP
|
||||
@@ -0,0 +1,38 @@
|
||||
description: >-
|
||||
Dummy token provider that listens to AuthRequired event from evse_manager and then publishes one token
|
||||
provides:
|
||||
main:
|
||||
description: Main implementation of dummy token provider always returning one configured token
|
||||
interface: auth_token_provider
|
||||
config:
|
||||
token:
|
||||
description: Dummy token string to return
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 20
|
||||
default: DEADBEEF
|
||||
type:
|
||||
description: Type to report for our dummy token
|
||||
type: string
|
||||
minLength: 2
|
||||
maxLength: 32
|
||||
default: RFID
|
||||
timeout:
|
||||
description: Time our dummy token is valid (in s)
|
||||
type: number
|
||||
minimum: 0
|
||||
maximum: 120
|
||||
default: 10
|
||||
connector_id:
|
||||
description: If >0, the generated token is only valid for this connector_id
|
||||
type: integer
|
||||
minimum: 0
|
||||
default: 0
|
||||
requires:
|
||||
evse:
|
||||
interface: evse_manager
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Thilo Molitor
|
||||
- Cornelius Claussen
|
||||
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# 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
|
||||
everest::helpers
|
||||
)
|
||||
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
|
||||
|
||||
target_sources(${MODULE_NAME}
|
||||
PRIVATE
|
||||
"main/auth_token_providerImpl.cpp"
|
||||
)
|
||||
|
||||
# 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,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#include "DummyTokenProviderManual.hpp"
|
||||
|
||||
namespace module {
|
||||
|
||||
void DummyTokenProviderManual::init() {
|
||||
invoke_init(*p_main);
|
||||
}
|
||||
|
||||
void DummyTokenProviderManual::ready() {
|
||||
invoke_ready(*p_main);
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
@@ -0,0 +1,60 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef DUMMY_TOKEN_PROVIDER_MANUAL_HPP
|
||||
#define DUMMY_TOKEN_PROVIDER_MANUAL_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for provided interface implementations
|
||||
#include <generated/interfaces/auth_token_provider/Implementation.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 DummyTokenProviderManual : public Everest::ModuleBase {
|
||||
public:
|
||||
DummyTokenProviderManual() = delete;
|
||||
DummyTokenProviderManual(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider,
|
||||
std::unique_ptr<auth_token_providerImplBase> p_main, Conf& config) :
|
||||
ModuleBase(info), mqtt(mqtt_provider), p_main(std::move(p_main)), config(config){};
|
||||
|
||||
Everest::MqttProvider& mqtt;
|
||||
const std::unique_ptr<auth_token_providerImplBase> p_main;
|
||||
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
|
||||
// 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 // DUMMY_TOKEN_PROVIDER_MANUAL_HPP
|
||||
@@ -0,0 +1,34 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include "auth_token_providerImpl.hpp"
|
||||
|
||||
#include <everest/helpers/helpers.hpp>
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
void auth_token_providerImpl::init() {
|
||||
std::string topic_path;
|
||||
if (config.mqtt_topic.empty()) {
|
||||
topic_path = "everest_api/" + mod->info.id + "/cmd/provide";
|
||||
} else {
|
||||
topic_path = config.mqtt_topic;
|
||||
}
|
||||
EVLOG_info << "Subscribing to MQTT topic for providing tokens: " << topic_path;
|
||||
mod->mqtt.subscribe(topic_path, [this](const std::string& msg) {
|
||||
try {
|
||||
types::authorization::ProvidedIdToken token = json::parse(msg);
|
||||
EVLOG_info << "Publishing new dummy token: " << everest::helpers::redact(token);
|
||||
publish_provided_token(token);
|
||||
} catch (const nlohmann::json::exception& e) {
|
||||
EVLOG_error << "Failed to handle JSON token from MQTT: " << e.what();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void auth_token_providerImpl::ready() {
|
||||
}
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef MAIN_AUTH_TOKEN_PROVIDER_IMPL_HPP
|
||||
#define MAIN_AUTH_TOKEN_PROVIDER_IMPL_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 3
|
||||
//
|
||||
|
||||
#include <generated/interfaces/auth_token_provider/Implementation.hpp>
|
||||
|
||||
#include "../DummyTokenProviderManual.hpp"
|
||||
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
// insert your custom include headers here
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
struct Conf {
|
||||
std::string mqtt_topic;
|
||||
};
|
||||
|
||||
class auth_token_providerImpl : public auth_token_providerImplBase {
|
||||
public:
|
||||
auth_token_providerImpl() = delete;
|
||||
auth_token_providerImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<DummyTokenProviderManual>& mod,
|
||||
Conf& config) :
|
||||
auth_token_providerImplBase(ev, "main"), mod(mod), config(config){};
|
||||
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
// insert your public definitions here
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
|
||||
protected:
|
||||
// no commands defined for this interface
|
||||
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
// insert your protected definitions here
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
|
||||
private:
|
||||
const Everest::PtrContainer<DummyTokenProviderManual>& mod;
|
||||
const Conf& config;
|
||||
|
||||
virtual void init() override;
|
||||
virtual void ready() override;
|
||||
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
// insert your private definitions here
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
};
|
||||
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
// insert other definitions here
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
|
||||
#endif // MAIN_AUTH_TOKEN_PROVIDER_IMPL_HPP
|
||||
@@ -0,0 +1,18 @@
|
||||
description: Dummy token provider that manually publishes one token
|
||||
provides:
|
||||
main:
|
||||
description: Main implementation of dummy token provider
|
||||
interface: auth_token_provider
|
||||
config:
|
||||
mqtt_topic:
|
||||
description: If no mqtt_topic is provided, the module subscribes to "everest_api/<module_id>/cmd/provide" by default. If mqtt_topic is provided, the module subscribes to that topic instead.
|
||||
type: string
|
||||
minLength: 0
|
||||
maxLength: 500
|
||||
default: ''
|
||||
enable_external_mqtt: true
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Kai-Uwe Hermann
|
||||
- Cornelius Claussen
|
||||
@@ -0,0 +1,13 @@
|
||||
load("//modules:module.bzl", "cc_everest_module")
|
||||
|
||||
IMPLS = [
|
||||
"main",
|
||||
]
|
||||
|
||||
cc_everest_module(
|
||||
name = "DummyTokenValidator",
|
||||
impls = IMPLS,
|
||||
deps = [
|
||||
"//lib/everest/helpers",
|
||||
],
|
||||
)
|
||||
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# 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
|
||||
everest::helpers
|
||||
)
|
||||
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
|
||||
|
||||
target_sources(${MODULE_NAME}
|
||||
PRIVATE
|
||||
"main/auth_token_validatorImpl.cpp"
|
||||
)
|
||||
|
||||
# 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,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#include "DummyTokenValidator.hpp"
|
||||
|
||||
namespace module {
|
||||
|
||||
void DummyTokenValidator::init() {
|
||||
invoke_init(*p_main);
|
||||
}
|
||||
|
||||
void DummyTokenValidator::ready() {
|
||||
invoke_ready(*p_main);
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
@@ -0,0 +1,58 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef DUMMY_TOKEN_VALIDATOR_HPP
|
||||
#define DUMMY_TOKEN_VALIDATOR_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for provided interface implementations
|
||||
#include <generated/interfaces/auth_token_validator/Implementation.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 DummyTokenValidator : public Everest::ModuleBase {
|
||||
public:
|
||||
DummyTokenValidator() = delete;
|
||||
DummyTokenValidator(const ModuleInfo& info, std::unique_ptr<auth_token_validatorImplBase> p_main, Conf& config) :
|
||||
ModuleBase(info), p_main(std::move(p_main)), config(config){};
|
||||
|
||||
const std::unique_ptr<auth_token_validatorImplBase> p_main;
|
||||
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
|
||||
// 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 // DUMMY_TOKEN_VALIDATOR_HPP
|
||||
@@ -0,0 +1,28 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include "auth_token_validatorImpl.hpp"
|
||||
|
||||
#include <everest/helpers/helpers.hpp>
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
void auth_token_validatorImpl::init() {
|
||||
}
|
||||
|
||||
void auth_token_validatorImpl::ready() {
|
||||
}
|
||||
|
||||
types::authorization::ValidationResult
|
||||
auth_token_validatorImpl::handle_validate_token(types::authorization::ProvidedIdToken& provided_token) {
|
||||
EVLOG_info << "Got validation request for token: " << everest::helpers::redact(provided_token.id_token.value);
|
||||
types::authorization::ValidationResult ret;
|
||||
ret.authorization_status = types::authorization::string_to_authorization_status(config.validation_result);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<int>(config.sleep * 1000)));
|
||||
EVLOG_info << "Returning validation status: " << config.validation_result;
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
@@ -0,0 +1,67 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef MAIN_AUTH_TOKEN_VALIDATOR_IMPL_HPP
|
||||
#define MAIN_AUTH_TOKEN_VALIDATOR_IMPL_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 3
|
||||
//
|
||||
|
||||
#include <generated/interfaces/auth_token_validator/Implementation.hpp>
|
||||
|
||||
#include "../DummyTokenValidator.hpp"
|
||||
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
// insert your custom include headers here
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
struct Conf {
|
||||
std::string validation_result;
|
||||
std::string validation_reason;
|
||||
double sleep;
|
||||
};
|
||||
|
||||
class auth_token_validatorImpl : public auth_token_validatorImplBase {
|
||||
public:
|
||||
auth_token_validatorImpl() = delete;
|
||||
auth_token_validatorImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<DummyTokenValidator>& mod,
|
||||
Conf& config) :
|
||||
auth_token_validatorImplBase(ev, "main"), mod(mod), config(config){};
|
||||
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
// insert your public definitions here
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
|
||||
protected:
|
||||
// command handler functions (virtual)
|
||||
virtual types::authorization::ValidationResult
|
||||
handle_validate_token(types::authorization::ProvidedIdToken& provided_token) override;
|
||||
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
// insert your protected definitions here
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
|
||||
private:
|
||||
const Everest::PtrContainer<DummyTokenValidator>& mod;
|
||||
const Conf& config;
|
||||
|
||||
virtual void init() override;
|
||||
virtual void ready() override;
|
||||
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
// insert your private definitions here
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
};
|
||||
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
// insert other definitions here
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
|
||||
#endif // MAIN_AUTH_TOKEN_VALIDATOR_IMPL_HPP
|
||||
@@ -0,0 +1,33 @@
|
||||
description: Dummy token validator always returning the same configured token validation result for every token
|
||||
provides:
|
||||
main:
|
||||
description: >-
|
||||
Main implementation of dummy token validator always returning the same configured token validation result for
|
||||
every token
|
||||
interface: auth_token_validator
|
||||
config:
|
||||
validation_result:
|
||||
description: Dummy validation result to return
|
||||
type: string
|
||||
enum:
|
||||
- Accepted
|
||||
- Blocked
|
||||
- Expired
|
||||
- Invalid
|
||||
default: Accepted
|
||||
validation_reason:
|
||||
description: Dummy validation reason to return
|
||||
type: string
|
||||
minLength: 5
|
||||
default: Token valid
|
||||
sleep:
|
||||
description: Time to wait before returning the dummy validation result (in s)
|
||||
type: number
|
||||
minimum: 0
|
||||
maximum: 120
|
||||
default: 0.5
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Thilo Molitor
|
||||
- Cornelius Claussen
|
||||
21
tools/EVerest-main/modules/Testing/DummyV2G/CMakeLists.txt
Normal file
21
tools/EVerest-main/modules/Testing/DummyV2G/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
|
||||
# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1
|
||||
|
||||
target_sources(${MODULE_NAME}
|
||||
PRIVATE
|
||||
"main/ISO15118_chargerImpl.cpp"
|
||||
)
|
||||
|
||||
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
|
||||
# insert other things like install cmds etc here
|
||||
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
|
||||
15
tools/EVerest-main/modules/Testing/DummyV2G/DummyV2G.cpp
Normal file
15
tools/EVerest-main/modules/Testing/DummyV2G/DummyV2G.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#include "DummyV2G.hpp"
|
||||
|
||||
namespace module {
|
||||
|
||||
void DummyV2G::init() {
|
||||
invoke_init(*p_main);
|
||||
}
|
||||
|
||||
void DummyV2G::ready() {
|
||||
invoke_ready(*p_main);
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
58
tools/EVerest-main/modules/Testing/DummyV2G/DummyV2G.hpp
Normal file
58
tools/EVerest-main/modules/Testing/DummyV2G/DummyV2G.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef DUMMY_V2G_HPP
|
||||
#define DUMMY_V2G_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for provided interface implementations
|
||||
#include <generated/interfaces/ISO15118_charger/Implementation.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 DummyV2G : public Everest::ModuleBase {
|
||||
public:
|
||||
DummyV2G() = delete;
|
||||
DummyV2G(const ModuleInfo& info, std::unique_ptr<ISO15118_chargerImplBase> p_main, Conf& config) :
|
||||
ModuleBase(info), p_main(std::move(p_main)), config(config){};
|
||||
|
||||
const std::unique_ptr<ISO15118_chargerImplBase> p_main;
|
||||
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
|
||||
// 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 // DUMMY_V2G_HPP
|
||||
@@ -0,0 +1,137 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include "ISO15118_chargerImpl.hpp"
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
void ISO15118_chargerImpl::init() {
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::ready() {
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_setup(types::iso15118::EVSEID& evse_id,
|
||||
types::iso15118::SaeJ2847BidiMode& sae_j2847_mode, bool& debug_mode) {
|
||||
// your code for cmd setup goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_set_charging_parameters(types::iso15118::SetupPhysicalValues& physical_values) {
|
||||
// your code for cmd set_charging_parameters goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_session_setup(std::vector<types::iso15118::PaymentOption>& payment_options,
|
||||
bool& supported_certificate_service,
|
||||
bool& central_contract_validation_allowed) {
|
||||
// your code for cmd session_setup goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_bpt_setup(types::iso15118::BptSetup& bpt_config) {
|
||||
// your code for cmd bpt_setup goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_set_powersupply_capabilities(types::power_supply_DC::Capabilities& capabilities) {
|
||||
// your code for cmd set_powersupply_capabilities goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_authorization_response(
|
||||
types::authorization::AuthorizationStatus& authorization_status,
|
||||
types::authorization::CertificateStatus& certificate_status) {
|
||||
// your code for cmd authorization_response goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_ac_contactor_closed(bool& status) {
|
||||
// your code for cmd ac_contactor_closed goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_dlink_ready(bool& value) {
|
||||
// your code for cmd dlink_ready goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_cable_check_finished(bool& status) {
|
||||
// your code for cmd cable_check_finished goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_receipt_is_required(bool& receipt_required) {
|
||||
// your code for cmd receipt_is_required goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_stop_charging(bool& stop) {
|
||||
// your code for cmd stop_charging goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_pause_charging(bool& pause) {
|
||||
// your code for cmd pause_charging goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_no_energy_pause_charging(types::iso15118::NoEnergyPauseMode& mode) {
|
||||
// your code for cmd no_energy_pause_charging goes here
|
||||
}
|
||||
|
||||
bool ISO15118_chargerImpl::handle_update_supported_app_protocols(
|
||||
types::iso15118::SupportedAppProtocols& supported_app_protocols) {
|
||||
// your code for cmd no_energy_pause_charging goes here
|
||||
return false;
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_update_energy_transfer_modes(
|
||||
std::vector<types::iso15118::EnergyTransferMode>& supported_energy_transfer_modes) {
|
||||
// your code for cmd update_energy_transfer_modes goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_update_ac_max_current(double& max_current) {
|
||||
// your code for cmd update_ac_max_current goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_update_ac_parameters(types::iso15118::AcParameters& ac_parameters) {
|
||||
// your code for cmd update_ac_parameters goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_update_ac_maximum_limits(types::iso15118::AcEvseMaximumPower& maximum_limits) {
|
||||
// your code for cmd update_ac_maximum_limits goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_update_ac_minimum_limits(types::iso15118::AcEvseMinimumPower& minimum_limits) {
|
||||
// your code for cmd update_ac_minimum_limits goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_update_ac_target_values(types::iso15118::AcTargetValues& target_values) {
|
||||
// your code for cmd update_ac_target_values goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_update_ac_present_power(types::units::Power& present_power) {
|
||||
// your code for cmd update_ac_present_power goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_update_dc_maximum_limits(types::iso15118::DcEvseMaximumLimits& maximum_limits) {
|
||||
// your code for cmd update_dc_maximum_limits goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_update_dc_minimum_limits(types::iso15118::DcEvseMinimumLimits& minimum_limits) {
|
||||
// your code for cmd update_dc_minimum_limits goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_update_isolation_status(types::iso15118::IsolationStatus& isolation_status) {
|
||||
// your code for cmd update_isolation_status goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_update_dc_present_values(
|
||||
types::iso15118::DcEvsePresentVoltageCurrent& present_voltage_current) {
|
||||
// your code for cmd update_dc_present_values goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_update_meter_info(types::powermeter::Powermeter& powermeter) {
|
||||
// your code for cmd update_meter_info goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_send_error(types::iso15118::EvseError& error) {
|
||||
// your code for cmd send_error goes here
|
||||
}
|
||||
|
||||
void ISO15118_chargerImpl::handle_reset_error() {
|
||||
// your code for cmd reset_error goes here
|
||||
}
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
@@ -0,0 +1,95 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef MAIN_ISO15118_CHARGER_IMPL_HPP
|
||||
#define MAIN_ISO15118_CHARGER_IMPL_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 3
|
||||
//
|
||||
|
||||
#include <generated/interfaces/ISO15118_charger/Implementation.hpp>
|
||||
|
||||
#include "../DummyV2G.hpp"
|
||||
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
// insert your custom include headers here
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
struct Conf {};
|
||||
|
||||
class ISO15118_chargerImpl : public ISO15118_chargerImplBase {
|
||||
public:
|
||||
ISO15118_chargerImpl() = delete;
|
||||
ISO15118_chargerImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<DummyV2G>& mod, Conf& config) :
|
||||
ISO15118_chargerImplBase(ev, "main"), mod(mod), config(config){};
|
||||
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
// insert your public definitions here
|
||||
// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
|
||||
|
||||
protected:
|
||||
// command handler functions (virtual)
|
||||
virtual void handle_setup(types::iso15118::EVSEID& evse_id, types::iso15118::SaeJ2847BidiMode& sae_j2847_mode,
|
||||
bool& debug_mode) override;
|
||||
virtual void handle_set_charging_parameters(types::iso15118::SetupPhysicalValues& physical_values) override;
|
||||
virtual void handle_session_setup(std::vector<types::iso15118::PaymentOption>& payment_options,
|
||||
bool& supported_certificate_service,
|
||||
bool& central_contract_validation_allowed) override;
|
||||
virtual void handle_bpt_setup(types::iso15118::BptSetup& bpt_config) override;
|
||||
virtual void handle_set_powersupply_capabilities(types::power_supply_DC::Capabilities& capabilities) override;
|
||||
virtual void handle_authorization_response(types::authorization::AuthorizationStatus& authorization_status,
|
||||
types::authorization::CertificateStatus& certificate_status) override;
|
||||
virtual void handle_ac_contactor_closed(bool& status) override;
|
||||
virtual void handle_dlink_ready(bool& value) override;
|
||||
virtual void handle_cable_check_finished(bool& status) override;
|
||||
virtual void handle_receipt_is_required(bool& receipt_required) override;
|
||||
virtual void handle_stop_charging(bool& stop) override;
|
||||
virtual void handle_pause_charging(bool& pause) override;
|
||||
virtual void handle_no_energy_pause_charging(types::iso15118::NoEnergyPauseMode& mode) override;
|
||||
virtual bool
|
||||
handle_update_supported_app_protocols(types::iso15118::SupportedAppProtocols& supported_app_protocols) override;
|
||||
virtual void handle_update_energy_transfer_modes(
|
||||
std::vector<types::iso15118::EnergyTransferMode>& supported_energy_transfer_modes) override;
|
||||
virtual void handle_update_ac_max_current(double& max_current) override;
|
||||
virtual void handle_update_ac_parameters(types::iso15118::AcParameters& ac_parameters) override;
|
||||
virtual void handle_update_ac_maximum_limits(types::iso15118::AcEvseMaximumPower& maximum_limits) override;
|
||||
virtual void handle_update_ac_minimum_limits(types::iso15118::AcEvseMinimumPower& minimum_limits) override;
|
||||
virtual void handle_update_ac_target_values(types::iso15118::AcTargetValues& target_values) override;
|
||||
virtual void handle_update_ac_present_power(types::units::Power& present_power) override;
|
||||
virtual void handle_update_dc_maximum_limits(types::iso15118::DcEvseMaximumLimits& maximum_limits) override;
|
||||
virtual void handle_update_dc_minimum_limits(types::iso15118::DcEvseMinimumLimits& minimum_limits) override;
|
||||
virtual void handle_update_isolation_status(types::iso15118::IsolationStatus& isolation_status) override;
|
||||
virtual void
|
||||
handle_update_dc_present_values(types::iso15118::DcEvsePresentVoltageCurrent& present_voltage_current) override;
|
||||
virtual void handle_update_meter_info(types::powermeter::Powermeter& powermeter) override;
|
||||
virtual void handle_send_error(types::iso15118::EvseError& error) override;
|
||||
virtual void handle_reset_error() override;
|
||||
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
// insert your protected definitions here
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
|
||||
private:
|
||||
const Everest::PtrContainer<DummyV2G>& mod;
|
||||
const Conf& config;
|
||||
|
||||
virtual void init() override;
|
||||
virtual void ready() override;
|
||||
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
// insert your private definitions here
|
||||
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
|
||||
};
|
||||
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
// insert other definitions here
|
||||
// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
|
||||
#endif // MAIN_ISO15118_CHARGER_IMPL_HPP
|
||||
10
tools/EVerest-main/modules/Testing/DummyV2G/manifest.yaml
Normal file
10
tools/EVerest-main/modules/Testing/DummyV2G/manifest.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
description: >-
|
||||
This module implements an empty dummy for HLC. It does not actually communicate with the car.
|
||||
provides:
|
||||
main:
|
||||
interface: ISO15118_charger
|
||||
description: This module implements the ISO15118-2 implementation of an AC or DC charger
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Cornelius Claussen
|
||||
1
tools/EVerest-main/modules/Testing/README.md
Normal file
1
tools/EVerest-main/modules/Testing/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Modules primarily used for testing purposes
|
||||
Reference in New Issue
Block a user