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,16 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
# 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,74 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#include "TerminalCostAndPriceMessage.hpp"
|
||||
|
||||
namespace module {
|
||||
|
||||
void TerminalCostAndPriceMessage::init() {
|
||||
this->r_session_cost->subscribe_tariff_message([](const types::session_cost::TariffMessage& message) {
|
||||
for (const types::text_message::MessageContent& message : message.messages) {
|
||||
EVLOG_info << "Charging price message"
|
||||
<< (message.language.has_value() ? " (" + message.language.value() + ")" : "") << ": "
|
||||
<< message.content;
|
||||
}
|
||||
});
|
||||
|
||||
this->r_session_cost->subscribe_session_cost([](const types::session_cost::SessionCost& session_cost) {
|
||||
if (!session_cost.cost_chunks.has_value()) {
|
||||
EVLOG_warning << "No session cost chunks provided in session cost.";
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t number_of_decimals = 0;
|
||||
if (session_cost.currency.decimals.has_value()) {
|
||||
if (session_cost.currency.decimals.value() < 0) {
|
||||
EVLOG_warning << "Number of decimals for currency can not be negative.";
|
||||
} else {
|
||||
number_of_decimals = static_cast<uint32_t>(session_cost.currency.decimals.value());
|
||||
}
|
||||
}
|
||||
|
||||
EVLOG_info << "Session cost status for session id " << session_cost.session_id << ": "
|
||||
<< session_status_to_string(session_cost.status);
|
||||
for (const types::session_cost::SessionCostChunk& chunk : session_cost.cost_chunks.value()) {
|
||||
if (chunk.cost.has_value()) {
|
||||
EVLOG_info << "Session cost until now: "
|
||||
<< static_cast<double>(chunk.cost.value().value) / (pow(10, number_of_decimals));
|
||||
}
|
||||
}
|
||||
|
||||
if (session_cost.charging_price.has_value()) {
|
||||
for (const types::session_cost::ChargingPriceComponent& charging_price :
|
||||
session_cost.charging_price.value()) {
|
||||
std::string category;
|
||||
double price = 0;
|
||||
if (charging_price.category.has_value()) {
|
||||
category = cost_category_to_string(charging_price.category.value());
|
||||
}
|
||||
|
||||
if (charging_price.price.has_value()) {
|
||||
int decimals = 0;
|
||||
if (charging_price.price.value().currency.decimals.has_value()) {
|
||||
decimals = charging_price.price.value().currency.decimals.value();
|
||||
}
|
||||
price = static_cast<double>(charging_price.price.value().value.value) / pow(10, decimals);
|
||||
}
|
||||
|
||||
EVLOG_info << "Charging price for category " << category << ": " << price << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (session_cost.message.has_value()) {
|
||||
for (const types::text_message::MessageContent& message : session_cost.message.value()) {
|
||||
EVLOG_info << "Charging price message"
|
||||
<< (message.language.has_value() ? " (" + message.language.value() + ")" : "") << ": "
|
||||
<< message.content;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void TerminalCostAndPriceMessage::ready() {
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
@@ -0,0 +1,59 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef TERMINAL_COST_AND_PRICE_MESSAGE_HPP
|
||||
#define TERMINAL_COST_AND_PRICE_MESSAGE_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for required interface implementations
|
||||
#include <generated/interfaces/session_cost/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 TerminalCostAndPriceMessage : public Everest::ModuleBase {
|
||||
public:
|
||||
TerminalCostAndPriceMessage() = delete;
|
||||
TerminalCostAndPriceMessage(const ModuleInfo& info, std::unique_ptr<session_costIntf> r_session_cost,
|
||||
Conf& config) :
|
||||
ModuleBase(info), r_session_cost(std::move(r_session_cost)), config(config){};
|
||||
|
||||
const std::unique_ptr<session_costIntf> r_session_cost;
|
||||
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 // TERMINAL_COST_AND_PRICE_MESSAGE_HPP
|
||||
@@ -0,0 +1,10 @@
|
||||
description: Example cost and price message module
|
||||
requires:
|
||||
session_cost:
|
||||
interface: session_cost
|
||||
min_connections: 1
|
||||
max_connections: 1
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Maaike Zijderveld
|
||||
Reference in New Issue
Block a user