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,45 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest
|
||||
#include <everest/io/utilities/generic_error_state.hpp>
|
||||
#include <string.h>
|
||||
|
||||
namespace everest::lib::io::utilities {
|
||||
|
||||
bool generic_error_state::set_error_status(int error_code) {
|
||||
m_current_error = error_code;
|
||||
auto on_error = error_code != 0;
|
||||
m_clear_error_pending = (not on_error) and m_on_error;
|
||||
m_on_error = on_error;
|
||||
return not m_on_error;
|
||||
}
|
||||
|
||||
bool generic_error_state::clear_error_pending() const {
|
||||
return m_clear_error_pending;
|
||||
}
|
||||
|
||||
bool generic_error_state::on_error() const {
|
||||
return m_on_error;
|
||||
}
|
||||
|
||||
int generic_error_state::current_error() const {
|
||||
return m_current_error;
|
||||
}
|
||||
|
||||
void generic_error_state::call_error_handler(cb_error& handler) const {
|
||||
if (handler) {
|
||||
handler(m_current_error, strerror(m_current_error));
|
||||
}
|
||||
}
|
||||
|
||||
void generic_error_state::clear_error_handler(cb_error& handler) {
|
||||
if (handler) {
|
||||
handler(0, strerror(0));
|
||||
}
|
||||
set_error_cleared();
|
||||
}
|
||||
|
||||
void generic_error_state::set_error_cleared() {
|
||||
m_clear_error_pending = false;
|
||||
}
|
||||
|
||||
} // namespace everest::lib::io::utilities
|
||||
@@ -0,0 +1,38 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include <chrono>
|
||||
#include <everest/io/utilities/stop_watch.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace everest::lib::io::utilities {
|
||||
|
||||
stop_watch::stop_watch(std::string const& id) : m_id(id) {
|
||||
m_start_time = clock::now();
|
||||
}
|
||||
|
||||
stop_watch::tp stop_watch::reset() {
|
||||
m_start_time = clock::now();
|
||||
return m_start_time;
|
||||
}
|
||||
|
||||
stop_watch::us stop_watch::stop() {
|
||||
m_end_time = clock::now();
|
||||
auto dura = std::chrono::duration_cast<us>(m_end_time - m_start_time);
|
||||
return dura;
|
||||
}
|
||||
|
||||
stop_watch::us stop_watch::lap() const {
|
||||
auto current = clock::now();
|
||||
auto dura = std::chrono::duration_cast<us>(current - m_start_time);
|
||||
return dura;
|
||||
}
|
||||
|
||||
stop_watch::~stop_watch() {
|
||||
if (not m_id.empty()) {
|
||||
auto dura = stop();
|
||||
std::cout << "StopWatch ( " << m_id << " ) duration " << dura.count() << "us" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace everest::lib::io::utilities
|
||||
Reference in New Issue
Block a user