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:
21
tools/EVerest-main/modules/Misc/ChargerInfo/CMakeLists.txt
Normal file
21
tools/EVerest-main/modules/Misc/ChargerInfo/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/charger_informationImpl.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/Misc/ChargerInfo/ChargerInfo.cpp
Normal file
15
tools/EVerest-main/modules/Misc/ChargerInfo/ChargerInfo.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#include "ChargerInfo.hpp"
|
||||
|
||||
namespace module {
|
||||
|
||||
void ChargerInfo::init() {
|
||||
invoke_init(*p_main);
|
||||
}
|
||||
|
||||
void ChargerInfo::ready() {
|
||||
invoke_ready(*p_main);
|
||||
}
|
||||
|
||||
} // namespace module
|
||||
72
tools/EVerest-main/modules/Misc/ChargerInfo/ChargerInfo.hpp
Normal file
72
tools/EVerest-main/modules/Misc/ChargerInfo/ChargerInfo.hpp
Normal file
@@ -0,0 +1,72 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef CHARGER_INFO_HPP
|
||||
#define CHARGER_INFO_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 2
|
||||
//
|
||||
|
||||
#include "ld-ev.hpp"
|
||||
|
||||
// headers for provided interface implementations
|
||||
#include <generated/interfaces/charger_information/Implementation.hpp>
|
||||
|
||||
// headers for required interface implementations
|
||||
#include <generated/interfaces/charger_information/Interface.hpp>
|
||||
#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 {
|
||||
std::string firmware_version_file;
|
||||
};
|
||||
|
||||
class ChargerInfo : public Everest::ModuleBase {
|
||||
public:
|
||||
ChargerInfo() = delete;
|
||||
ChargerInfo(const ModuleInfo& info, std::unique_ptr<charger_informationImplBase> p_main,
|
||||
std::vector<std::unique_ptr<kvsIntf>> r_kvs,
|
||||
std::vector<std::unique_ptr<charger_informationIntf>> r_charger_information, Conf& config) :
|
||||
ModuleBase(info),
|
||||
p_main(std::move(p_main)),
|
||||
r_kvs(std::move(r_kvs)),
|
||||
r_charger_information(std::move(r_charger_information)),
|
||||
config(config){};
|
||||
|
||||
const std::unique_ptr<charger_informationImplBase> p_main;
|
||||
const std::vector<std::unique_ptr<kvsIntf>> r_kvs;
|
||||
const std::vector<std::unique_ptr<charger_informationIntf>> r_charger_information;
|
||||
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 // CHARGER_INFO_HPP
|
||||
@@ -0,0 +1,6 @@
|
||||
manufacturer: "Pionix GmbH"
|
||||
manufacturer_url: "https://www.pionix.com/"
|
||||
vendor: "Pionix"
|
||||
model: "BelayBox"
|
||||
chargepoint_serial: "0123"
|
||||
firmware_version: "0.1.2"
|
||||
@@ -0,0 +1,80 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include "charger_informationImpl.hpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
void charger_informationImpl::init() {
|
||||
}
|
||||
|
||||
void charger_informationImpl::ready() {
|
||||
json info(handle_get_charger_information());
|
||||
|
||||
EVLOG_debug << "ChargerInformation: " << info.dump();
|
||||
}
|
||||
|
||||
std::string charger_informationImpl::load_fw_version_from_file(const std::string& fn) {
|
||||
std::ifstream fw_version_file(fn);
|
||||
std::string first_line;
|
||||
|
||||
if (!fw_version_file) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!std::getline(fw_version_file, first_line)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return first_line;
|
||||
}
|
||||
|
||||
types::charger_information::ChargerInformation charger_informationImpl::handle_get_charger_information() {
|
||||
std::vector<std::string> keys = {"vendor", "model", "chargepoint_serial", "chargebox_serial",
|
||||
"friendly_name", "manufacturer", "manufacturer_url", "model_url",
|
||||
"model_number", "model_revision", "board_revision", "firmware_version"};
|
||||
json info = {};
|
||||
|
||||
// in case we are chained, retrieve data from previous module
|
||||
if (not this->mod->r_charger_information.empty()) {
|
||||
info = this->mod->r_charger_information[0]->call_get_charger_information();
|
||||
}
|
||||
|
||||
// iterate over all linked key-value stores and merge all items,
|
||||
// when a key exists in more than one kvs then the last one wins
|
||||
for (const auto& kvs : mod->r_kvs) {
|
||||
for (const auto k : keys) {
|
||||
if (kvs->call_exists(k)) {
|
||||
const auto v = kvs->call_load(k);
|
||||
info[k] = std::get<std::string>(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// finally check whether we should load the firmware version from a simple plain text file
|
||||
if (!mod->config.firmware_version_file.empty()) {
|
||||
info["firmware_version"] = load_fw_version_from_file(mod->config.firmware_version_file);
|
||||
}
|
||||
|
||||
// generate fallback friendly_name: we use the chargepoint's serial,
|
||||
// because we assume that this one is printed on a device label and not the (internal)
|
||||
// chargebox' serial number (aka controller serial number) which is usually only important for
|
||||
// the manufacturer itself
|
||||
if (info.contains("vendor") and info.contains("model") and info.contains("chargepoint_serial") and
|
||||
not info.contains("friendly_name")) {
|
||||
info["friendly_name"] = info["vendor"].get<std::string>() + " " + info["model"].get<std::string>() + " [" +
|
||||
info["chargepoint_serial"].get<std::string>() + "]";
|
||||
}
|
||||
|
||||
EVLOG_debug << "ChargerInformation: " << info.dump();
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace main
|
||||
} // namespace module
|
||||
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
#ifndef MAIN_CHARGER_INFORMATION_IMPL_HPP
|
||||
#define MAIN_CHARGER_INFORMATION_IMPL_HPP
|
||||
|
||||
//
|
||||
// AUTO GENERATED - MARKED REGIONS WILL BE KEPT
|
||||
// template version 3
|
||||
//
|
||||
|
||||
#include <generated/interfaces/charger_information/Implementation.hpp>
|
||||
|
||||
#include "../ChargerInfo.hpp"
|
||||
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
// insert your custom include headers here
|
||||
#include <string>
|
||||
// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1
|
||||
|
||||
namespace module {
|
||||
namespace main {
|
||||
|
||||
struct Conf {};
|
||||
|
||||
class charger_informationImpl : public charger_informationImplBase {
|
||||
public:
|
||||
charger_informationImpl() = delete;
|
||||
charger_informationImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<ChargerInfo>& mod, Conf& config) :
|
||||
charger_informationImplBase(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::charger_information::ChargerInformation handle_get_charger_information() override;
|
||||
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
// insert your protected definitions here
|
||||
// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
|
||||
|
||||
private:
|
||||
const Everest::PtrContainer<ChargerInfo>& 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::string load_fw_version_from_file(const std::string& fn);
|
||||
// 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_CHARGER_INFORMATION_IMPL_HPP
|
||||
30
tools/EVerest-main/modules/Misc/ChargerInfo/manifest.yaml
Normal file
30
tools/EVerest-main/modules/Misc/ChargerInfo/manifest.yaml
Normal file
@@ -0,0 +1,30 @@
|
||||
description: >-
|
||||
Provides a charger information interface, backed by simple KVS interface.
|
||||
With the optional dependency to another charger information node, it is possible to chain
|
||||
multiple sources of information.
|
||||
config:
|
||||
firmware_version_file:
|
||||
description: >-
|
||||
Sometimes the firmware version cannot be retrieved from the key-value interface.
|
||||
Then it is possible to provide the firmware version string from a simple text file
|
||||
in the filesystem. The first line of this file is used as-is, the remaining file content
|
||||
is ignored.
|
||||
Give the full path to the file which contains the firmware version string.
|
||||
type: string
|
||||
provides:
|
||||
main:
|
||||
interface: charger_information
|
||||
description: Provides the charger information interface
|
||||
requires:
|
||||
kvs:
|
||||
interface: kvs
|
||||
min_connections: 1
|
||||
max_connections: 10
|
||||
charger_information:
|
||||
interface: charger_information
|
||||
min_connections: 0
|
||||
max_connections: 1
|
||||
metadata:
|
||||
license: https://opensource.org/licenses/Apache-2.0
|
||||
authors:
|
||||
- Michael Heimpold
|
||||
Reference in New Issue
Block a user