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:
Eric F
2026-06-08 00:38:27 -04:00
parent 468cfeaa50
commit d398a6ced2
7326 changed files with 1177561 additions and 7 deletions

View File

@@ -0,0 +1,5 @@
ev_add_module(Example)
ev_add_module(ExampleUser)
ev_add_module(TerminalCostAndPriceMessage)
ev_add_module(TerminalDisplayMessage)
ev_add_module(OCPPExtensionExample)

View File

@@ -0,0 +1,22 @@
#
# 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
"example/exampleImpl.cpp"
"store/kvsImpl.cpp"
)
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
# insert other things like install cmds etc here
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1

View File

@@ -0,0 +1,19 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2021 Pionix GmbH and Contributors to EVerest
#include "Example.hpp"
namespace module {
void Example::init() {
invoke_init(*p_example);
invoke_init(*p_store);
}
void Example::ready() {
invoke_ready(*p_example);
invoke_ready(*p_store);
mqtt.publish("external/topic", "data");
}
} // namespace module

View File

@@ -0,0 +1,71 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#ifndef EXAMPLE_HPP
#define EXAMPLE_HPP
//
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
// template version 2
//
#include "ld-ev.hpp"
// headers for provided interface implementations
#include <generated/interfaces/example/Implementation.hpp>
#include <generated/interfaces/kvs/Implementation.hpp>
// headers for required interface implementations
#include <generated/interfaces/kvs/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 Example : public Everest::ModuleBase {
public:
Example() = delete;
Example(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, std::unique_ptr<exampleImplBase> p_example,
std::unique_ptr<kvsImplBase> p_store, std::unique_ptr<kvsIntf> r_kvs, Conf& config) :
ModuleBase(info),
mqtt(mqtt_provider),
p_example(std::move(p_example)),
p_store(std::move(p_store)),
r_kvs(std::move(r_kvs)),
config(config){};
Everest::MqttProvider& mqtt;
const std::unique_ptr<exampleImplBase> p_example;
const std::unique_ptr<kvsImplBase> p_store;
const std::unique_ptr<kvsIntf> r_kvs;
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 // EXAMPLE_HPP

View File

@@ -0,0 +1,45 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2021 Pionix GmbH and Contributors to EVerest
#include "exampleImpl.hpp"
// initial cpp template for interface example_child
// this file should not be overwritten by the code generator again
namespace module {
namespace example {
void exampleImpl::init() {
mod->mqtt.subscribe("external/a",
[](json data) { EVLOG_error << "received data from external MQTT handler: " << data.dump(); });
}
void exampleImpl::ready() {
publish_max_current(config.current);
mod->r_kvs->call_store("test", "test");
}
bool exampleImpl::handle_uses_something(std::string& key) {
if (mod->r_kvs->call_exists(key)) {
EVLOG_debug << "IT SHOULD NOT AND DOES NOT EXIST";
}
Array test_array = {1, 2, 3};
mod->r_kvs->call_store(key, test_array);
bool exi = mod->r_kvs->call_exists(key);
if (exi) {
EVLOG_debug << "IT ACTUALLY EXISTS";
}
auto ret = mod->r_kvs->call_load(key);
Array arr = std::get<Array>(ret);
EVLOG_debug << "loaded array: " << arr << ", original array: " << test_array;
return exi;
};
} // namespace example
} // namespace module

View File

@@ -0,0 +1,65 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#ifndef EXAMPLE_EXAMPLE_IMPL_HPP
#define EXAMPLE_EXAMPLE_IMPL_HPP
//
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
// template version 3
//
#include <generated/interfaces/example/Implementation.hpp>
#include "../Example.hpp"
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
// insert your custom include headers here
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
namespace module {
namespace example {
struct Conf {
double current;
std::string enum_test;
int enum_test2;
};
class exampleImpl : public exampleImplBase {
public:
exampleImpl() = delete;
exampleImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<Example>& mod, Conf& config) :
exampleImplBase(ev, "example"), 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 bool handle_uses_something(std::string& key) override;
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
// insert your protected definitions here
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
private:
const Everest::PtrContainer<Example>& 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 example
} // namespace module
#endif // EXAMPLE_EXAMPLE_IMPL_HPP

View File

@@ -0,0 +1,37 @@
description: Simple example module written in C++
provides:
example:
interface: example
description: This implements an example interface that uses multiple framework features
config:
current:
description: The current the physical connector can supply
type: number
minimum: 1
maximum: 60
enum_test:
description: A config value that tests the enum type
type: string
enum:
- one
- two
- three
enum_test2:
description: Another config value that tests the enum type
type: integer
enum:
- 1
- 2
- 3
store:
interface: kvs
description: This implements the kvs interface, mostly for testing multiple interfaces in one manifest
requires:
kvs:
interface: kvs
enable_external_mqtt: true
metadata:
license: https://opensource.org/licenses/Apache-2.0
authors:
- Kai-Uwe Hermann
- Andreas Heinrich

View File

@@ -0,0 +1,32 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2021 Pionix GmbH and Contributors to EVerest
#include "kvsImpl.hpp"
namespace module {
namespace store {
void kvsImpl::init() {
}
void kvsImpl::ready() {
}
void kvsImpl::handle_store(std::string& key,
std::variant<std::nullptr_t, Array, Object, bool, double, int, std::string>& value) {
mod->r_kvs->call_store(key, value);
};
std::variant<std::nullptr_t, Array, Object, bool, double, int, std::string> kvsImpl::handle_load(std::string& key) {
return mod->r_kvs->call_load(key);
};
void kvsImpl::handle_delete(std::string& key) {
mod->r_kvs->call_delete(key);
};
bool kvsImpl::handle_exists(std::string& key) {
return mod->r_kvs->call_exists(key);
};
} // namespace store
} // namespace module

View File

@@ -0,0 +1,67 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#ifndef STORE_KVS_IMPL_HPP
#define STORE_KVS_IMPL_HPP
//
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
// template version 3
//
#include <generated/interfaces/kvs/Implementation.hpp>
#include "../Example.hpp"
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
// insert your custom include headers here
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
namespace module {
namespace store {
struct Conf {};
class kvsImpl : public kvsImplBase {
public:
kvsImpl() = delete;
kvsImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<Example>& mod, Conf& config) :
kvsImplBase(ev, "store"), 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_store(std::string& key,
std::variant<std::nullptr_t, Array, Object, bool, double, int, std::string>& value) override;
virtual std::variant<std::nullptr_t, Array, Object, bool, double, int, std::string>
handle_load(std::string& key) override;
virtual void handle_delete(std::string& key) override;
virtual bool handle_exists(std::string& key) override;
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
// insert your protected definitions here
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
private:
const Everest::PtrContainer<Example>& 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 store
} // namespace module
#endif // STORE_KVS_IMPL_HPP

View 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
"example_user/example_userImpl.cpp"
)
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
# insert other things like install cmds etc here
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1

View File

@@ -0,0 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2021 Pionix GmbH and Contributors to EVerest
#include "ExampleUser.hpp"
namespace module {
void ExampleUser::init() {
invoke_init(*p_example_user);
}
void ExampleUser::ready() {
invoke_ready(*p_example_user);
}
} // namespace module

View File

@@ -0,0 +1,63 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#ifndef EXAMPLE_USER_HPP
#define EXAMPLE_USER_HPP
//
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
// template version 2
//
#include "ld-ev.hpp"
// headers for provided interface implementations
#include <generated/interfaces/example_user/Implementation.hpp>
// headers for required interface implementations
#include <generated/interfaces/example/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 ExampleUser : public Everest::ModuleBase {
public:
ExampleUser() = delete;
ExampleUser(const ModuleInfo& info, std::unique_ptr<example_userImplBase> p_example_user,
std::unique_ptr<exampleIntf> r_example, Conf& config) :
ModuleBase(info), p_example_user(std::move(p_example_user)), r_example(std::move(r_example)), config(config){};
const std::unique_ptr<example_userImplBase> p_example_user;
const std::unique_ptr<exampleIntf> r_example;
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 // EXAMPLE_USER_HPP

View File

@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2021 Pionix GmbH and Contributors to EVerest
#include "example_userImpl.hpp"
namespace module {
namespace example_user {
void example_userImpl::init() {
}
void example_userImpl::ready() {
mod->r_example->call_uses_something("hello_there");
}
} // namespace example_user
} // namespace module

View File

@@ -0,0 +1,61 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#ifndef EXAMPLE_USER_EXAMPLE_USER_IMPL_HPP
#define EXAMPLE_USER_EXAMPLE_USER_IMPL_HPP
//
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
// template version 3
//
#include <generated/interfaces/example_user/Implementation.hpp>
#include "../ExampleUser.hpp"
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
// insert your custom include headers here
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
namespace module {
namespace example_user {
struct Conf {};
class example_userImpl : public example_userImplBase {
public:
example_userImpl() = delete;
example_userImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<ExampleUser>& mod, Conf& config) :
example_userImplBase(ev, "example_user"), 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<ExampleUser>& mod;
const Conf& config;
virtual void init() override;
virtual void ready() override;
// ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1
// insert your private definitions here
Everest::error::ErrorHandle received_error;
// 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 example_user
} // namespace module
#endif // EXAMPLE_USER_EXAMPLE_USER_IMPL_HPP

View File

@@ -0,0 +1,13 @@
description: Simple example module written in C++ and using the other example module
provides:
example_user:
interface: example_user
description: This implements the example_user interface
requires:
example:
interface: example
metadata:
license: https://opensource.org/licenses/Apache-2.0
authors:
- Kai-Uwe Hermann
- Andreas Heinrich

View File

@@ -0,0 +1,22 @@
#
# 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
"data_transfer/ocpp_data_transferImpl.cpp"
)
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
# insert other things like install cmds etc here
install(FILES Custom.json DESTINATION ${CMAKE_INSTALL_DATADIR}/everest/modules/OCPP/profile_schemas)
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1

View File

@@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Json schema for Custom configuration keys",
"$comment": "This is just an example schema and can be modified according to custom requirements",
"type": "object",
"required": [],
"properties": {
"ExampleConfigurationKey": {
"type": "string",
"description": "Custom key",
"readOnly": false
}
}
}

View File

@@ -0,0 +1,93 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#include "OCPPExtensionExample.hpp"
namespace module {
void OCPPExtensionExample::init() {
invoke_init(*p_data_transfer);
}
void OCPPExtensionExample::ready() {
invoke_ready(*p_data_transfer);
std::istringstream ss(this->config.keys_to_monitor);
std::vector<types::ocpp::ComponentVariable> component_variables;
std::string key;
while (std::getline(ss, key, ',')) {
// Push each token into the vector
component_variables.push_back({{""}, {key}}); // For OCPP1.6 we only need to specify the variable.name
}
// We register monitors for custom configuration keys here
this->r_ocpp->call_monitor_variables(component_variables);
// anytime this configuration key is changed by the CSMS and we have
// registered a monitor, this callback is executed
this->r_ocpp->subscribe_event_data([](types::ocpp::EventData event_data) {
// Add your custom handler here
EVLOG_info << "Configuration key: " << event_data.component_variable.variable.name
<< " has been changed by CSMS to: " << event_data.actual_value;
});
std::vector<types::ocpp::SetVariableRequest> set_variable_requests;
set_variable_requests.push_back({{{""}, {"ExampleConfigurationKey"}}, "ExampleValue"});
EVLOG_info << "Setting custom configuration key...";
const auto set_variable_results = this->r_ocpp->call_set_variables(set_variable_requests, "example");
for (const auto& set_variable_result : set_variable_results) {
if (set_variable_result.status == types::ocpp::SetVariableStatusEnumType::Accepted) {
EVLOG_info << "Successfully set ExampleConfigurationKey";
} else {
EVLOG_info << "Could not set ExampleConfigurationKey: "
<< types::ocpp::set_variable_status_enum_type_to_string(set_variable_result.status);
}
}
// adding a configuration key that does not exist to show that this will be
// part of the unknown keys of the result
component_variables.push_back({{""}, {"KeyThatIsNotConfigured"}});
std::vector<types::ocpp::GetVariableRequest> get_variables_requests;
for (const auto& component_variable : component_variables) {
get_variables_requests.push_back({component_variable});
}
EVLOG_info << "Requesting configuration keys from OCPP...";
const auto get_variables_results = this->r_ocpp->call_get_variables(get_variables_requests);
for (const auto& get_variables_result : get_variables_results) {
if (get_variables_result.status == types::ocpp::GetVariableStatusEnumType::Accepted) {
EVLOG_info << "Key: " << get_variables_result.component_variable.variable.name << ": "
<< get_variables_result.value.value();
} else {
EVLOG_info << "Unknown: " << get_variables_result.component_variable.variable.name;
}
}
types::ocpp::DataTransferRequest data_transfer_request;
data_transfer_request.vendor_id = "EVerest";
data_transfer_request.data.emplace("hi");
auto data_transfer_response = this->r_data_transfer->call_data_transfer(data_transfer_request);
switch (data_transfer_response.status) {
case types::ocpp::DataTransferStatus::Accepted:
EVLOG_info << "Data transfer was accepted";
break;
case types::ocpp::DataTransferStatus::Rejected:
EVLOG_info << "Data transfer was rejected";
break;
case types::ocpp::DataTransferStatus::UnknownVendorId:
EVLOG_info << "Data transfer was rejected (UnknownVendorId)";
break;
case types::ocpp::DataTransferStatus::UnknownMessageId:
EVLOG_info << "Data transfer was rejected (UnknownMessageId)";
break;
default:
break;
}
}
} // namespace module

View File

@@ -0,0 +1,72 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#ifndef OCPPEXTENSION_EXAMPLE_HPP
#define OCPPEXTENSION_EXAMPLE_HPP
//
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
// template version 2
//
#include "ld-ev.hpp"
// headers for provided interface implementations
#include <generated/interfaces/ocpp_data_transfer/Implementation.hpp>
// headers for required interface implementations
#include <generated/interfaces/ocpp/Interface.hpp>
#include <generated/interfaces/ocpp_data_transfer/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 {
std::string keys_to_monitor;
};
class OCPPExtensionExample : public Everest::ModuleBase {
public:
OCPPExtensionExample() = delete;
OCPPExtensionExample(const ModuleInfo& info, std::unique_ptr<ocpp_data_transferImplBase> p_data_transfer,
std::unique_ptr<ocppIntf> r_ocpp, std::unique_ptr<ocpp_data_transferIntf> r_data_transfer,
Conf& config) :
ModuleBase(info),
p_data_transfer(std::move(p_data_transfer)),
r_ocpp(std::move(r_ocpp)),
r_data_transfer(std::move(r_data_transfer)),
config(config){};
const std::unique_ptr<ocpp_data_transferImplBase> p_data_transfer;
const std::unique_ptr<ocppIntf> r_ocpp;
const std::unique_ptr<ocpp_data_transferIntf> r_data_transfer;
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 // OCPPEXTENSION_EXAMPLE_HPP

View File

@@ -0,0 +1,31 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#include "ocpp_data_transferImpl.hpp"
namespace module {
namespace data_transfer {
void ocpp_data_transferImpl::init() {
}
void ocpp_data_transferImpl::ready() {
}
types::ocpp::DataTransferResponse
ocpp_data_transferImpl::handle_data_transfer(types::ocpp::DataTransferRequest& request) {
types::ocpp::DataTransferResponse response;
response.status = types::ocpp::DataTransferStatus::Rejected;
if (request.vendor_id == "EVerest") {
response.data = "hello there";
response.status = types::ocpp::DataTransferStatus::Accepted;
} else {
response.status = types::ocpp::DataTransferStatus::UnknownVendorId;
}
return response;
}
} // namespace data_transfer
} // namespace module

View File

@@ -0,0 +1,62 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#ifndef DATA_TRANSFER_OCPP_DATA_TRANSFER_IMPL_HPP
#define DATA_TRANSFER_OCPP_DATA_TRANSFER_IMPL_HPP
//
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
// template version 3
//
#include <generated/interfaces/ocpp_data_transfer/Implementation.hpp>
#include "../OCPPExtensionExample.hpp"
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
// insert your custom include headers here
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
namespace module {
namespace data_transfer {
struct Conf {};
class ocpp_data_transferImpl : public ocpp_data_transferImplBase {
public:
ocpp_data_transferImpl() = delete;
ocpp_data_transferImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<OCPPExtensionExample>& mod,
Conf& config) :
ocpp_data_transferImplBase(ev, "data_transfer"), 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::ocpp::DataTransferResponse handle_data_transfer(types::ocpp::DataTransferRequest& request) override;
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
// insert your protected definitions here
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
private:
const Everest::PtrContainer<OCPPExtensionExample>& 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 data_transfer
} // namespace module
#endif // DATA_TRANSFER_OCPP_DATA_TRANSFER_IMPL_HPP

View File

@@ -0,0 +1,25 @@
description: >-
This is an example module that shows how the OCPP module of EVerest could be extended using the DataTransfer functionality
and custom configuration keys
config:
keys_to_monitor:
description: Commad seperated list of keys that should be monitored
type: string
default: "HeartbeatInterval,SecurityProfile,ExampleConfigurationKey"
provides:
data_transfer:
description: OCPP data transfer
interface: ocpp_data_transfer
requires:
ocpp:
interface: ocpp
min_connections: 1
max_connections: 1
data_transfer:
interface: ocpp_data_transfer
min_connections: 1
max_connections: 1
metadata:
license: https://opensource.org/licenses/Apache-2.0
authors:
- Piet Gömpel

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View 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
"display_message/display_messageImpl.cpp"
)
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1
# insert other things like install cmds etc here
# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1

View File

@@ -0,0 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#include "TerminalDisplayMessage.hpp"
namespace module {
void TerminalDisplayMessage::init() {
invoke_init(*p_display_message);
}
void TerminalDisplayMessage::ready() {
invoke_ready(*p_display_message);
}
} // namespace module

View File

@@ -0,0 +1,59 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#ifndef TERMINAL_DISPLAY_MESSAGE_HPP
#define TERMINAL_DISPLAY_MESSAGE_HPP
//
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
// template version 2
//
#include "ld-ev.hpp"
// headers for provided interface implementations
#include <generated/interfaces/display_message/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 TerminalDisplayMessage : public Everest::ModuleBase {
public:
TerminalDisplayMessage() = delete;
TerminalDisplayMessage(const ModuleInfo& info, std::unique_ptr<display_messageImplBase> p_display_message,
Conf& config) :
ModuleBase(info), p_display_message(std::move(p_display_message)), config(config){};
const std::unique_ptr<display_messageImplBase> p_display_message;
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_DISPLAY_MESSAGE_HPP

View File

@@ -0,0 +1,78 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#include "display_messageImpl.hpp"
namespace module {
namespace display_message {
void display_messageImpl::init() {
}
void display_messageImpl::ready() {
}
types::display_message::SetDisplayMessageResponse
display_messageImpl::handle_set_display_message(std::vector<types::display_message::DisplayMessage>& request) {
types::display_message::SetDisplayMessageResponse response;
if (request.empty()) {
response.status = types::display_message::DisplayMessageStatusEnum::Rejected;
response.status_info = "No request sent";
return response;
}
for (const types::display_message::DisplayMessage& message : request) {
EVLOG_info << "New display message"
<< (message.identifier_id.has_value() ? " for identifier id " + message.identifier_id.value() : "")
<< ": " << message.message.content;
}
response.status = types::display_message::DisplayMessageStatusEnum::Accepted;
return response;
}
types::display_message::GetDisplayMessageResponse
display_messageImpl::handle_get_display_messages(types::display_message::GetDisplayMessageRequest& request) {
EVLOG_info << "Get display messages request received"
<< (request.priority.has_value() ? " for display messages with priority " +
std::to_string(static_cast<int>(request.priority.value()))
: "")
<< (request.state.has_value()
? " for display messages with state " + std::to_string(static_cast<int>(request.state.value()))
: "");
if (request.id.has_value()) {
std::string ids;
for (const int32_t& id : request.id.value()) {
ids += std::to_string(id);
ids += " ";
}
EVLOG_info << "Get display messages for specific id's: " << ids;
}
types::display_message::GetDisplayMessageResponse response;
response.messages = std::vector<types::display_message::DisplayMessage>();
types::display_message::DisplayMessage test_message;
test_message.message.content = "This is a test message";
test_message.message.format = types::text_message::MessageFormat::UTF8;
test_message.message.language = "en";
response.messages->push_back(test_message);
types::display_message::DisplayMessage test_message_url;
test_message_url.message.content = "https://pionix.de";
test_message_url.message.format = types::text_message::MessageFormat::URI;
response.messages->push_back(test_message_url);
return response;
}
types::display_message::ClearDisplayMessageResponse
display_messageImpl::handle_clear_display_message(types::display_message::ClearDisplayMessageRequest& request) {
EVLOG_info << "Clear display message request received for id: " << request.id;
types::display_message::ClearDisplayMessageResponse response;
response.status = types::display_message::ClearMessageResponseEnum::Accepted;
response.status_info = "Yes it is done!";
return response;
}
} // namespace display_message
} // namespace module

View File

@@ -0,0 +1,67 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Pionix GmbH and Contributors to EVerest
#ifndef DISPLAY_MESSAGE_DISPLAY_MESSAGE_IMPL_HPP
#define DISPLAY_MESSAGE_DISPLAY_MESSAGE_IMPL_HPP
//
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
// template version 3
//
#include <generated/interfaces/display_message/Implementation.hpp>
#include "../TerminalDisplayMessage.hpp"
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
// insert your custom include headers here
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
namespace module {
namespace display_message {
struct Conf {};
class display_messageImpl : public display_messageImplBase {
public:
display_messageImpl() = delete;
display_messageImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<TerminalDisplayMessage>& mod,
Conf& config) :
display_messageImplBase(ev, "display_message"), 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::display_message::SetDisplayMessageResponse
handle_set_display_message(std::vector<types::display_message::DisplayMessage>& request) override;
virtual types::display_message::GetDisplayMessageResponse
handle_get_display_messages(types::display_message::GetDisplayMessageRequest& request) override;
virtual types::display_message::ClearDisplayMessageResponse
handle_clear_display_message(types::display_message::ClearDisplayMessageRequest& request) override;
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
// insert your protected definitions here
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
private:
const Everest::PtrContainer<TerminalDisplayMessage>& 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 display_message
} // namespace module
#endif // DISPLAY_MESSAGE_DISPLAY_MESSAGE_IMPL_HPP

View File

@@ -0,0 +1,9 @@
description: Example display message module
provides:
display_message:
description: module to show a message
interface: display_message
metadata:
license: https://opensource.org/licenses/Apache-2.0
authors:
- Maaike Zijderveld