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,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
|
||||
Reference in New Issue
Block a user