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,30 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright chargebyte GmbH and Contributors to EVerest
|
||||
|
||||
#include "ChargePoint.hpp"
|
||||
#include "../RpcHandler.hpp"
|
||||
|
||||
namespace notifications {
|
||||
|
||||
static const std::string NOTIFICATION_CHARGEPOINT_ACTIVE_ERRORS_CHANGED = "ChargePoint.ActiveErrorsChanged";
|
||||
|
||||
ChargePoint::ChargePoint(std::shared_ptr<rpc::JsonRpc2ServerWithClient> rpc_server, data::DataStoreCharger& dataobj,
|
||||
int precision) :
|
||||
m_dataobj(dataobj), m_rpc_server(std::move(rpc_server)), m_precision(precision) {
|
||||
// Register notification callbacks for the charger errors
|
||||
m_dataobj.chargererrors.register_notification_callback(
|
||||
[this](const std::vector<RPCDataTypes::ErrorObj>& active_errors) {
|
||||
this->send_active_errors_changed(active_errors);
|
||||
});
|
||||
};
|
||||
|
||||
// Notifications
|
||||
|
||||
void ChargePoint::send_active_errors_changed(const std::vector<RPCDataTypes::ErrorObj>& active_errors) {
|
||||
RPCDataTypes::ChargePointActiveErrorsChangedObj active_errors_changed;
|
||||
active_errors_changed.active_errors = active_errors;
|
||||
m_rpc_server->CallNotificationWithObject(NOTIFICATION_CHARGEPOINT_ACTIVE_ERRORS_CHANGED, active_errors_changed,
|
||||
m_precision);
|
||||
}
|
||||
|
||||
} // namespace notifications
|
||||
@@ -0,0 +1,40 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright chargebyte GmbH and Contributors to EVerest
|
||||
#ifndef NOTIFICATIONS_CHARGEPOINT_HPP
|
||||
#define NOTIFICATIONS_CHARGEPOINT_HPP
|
||||
|
||||
#include "../../data/DataStore.hpp"
|
||||
#include <jsonrpccxx/client.hpp>
|
||||
|
||||
namespace RPCDataTypes = types::json_rpc_api;
|
||||
|
||||
// forward declaration
|
||||
namespace rpc {
|
||||
class JsonRpc2ServerWithClient;
|
||||
}
|
||||
|
||||
namespace notifications {
|
||||
|
||||
class ChargePoint {
|
||||
public:
|
||||
// Constructor and Destructor
|
||||
// Deleting the default constructor to ensure the class is always initialized with a DataStoreCharger object
|
||||
ChargePoint() = delete;
|
||||
// This needs to take a copy of rpc_server for reference counting, not a reference to it
|
||||
ChargePoint(std::shared_ptr<rpc::JsonRpc2ServerWithClient> rpc_server, data::DataStoreCharger& dataobj,
|
||||
int precision = 3);
|
||||
~ChargePoint() = default;
|
||||
|
||||
// Notifications
|
||||
void send_active_errors_changed(const std::vector<RPCDataTypes::ErrorObj>& active_errors);
|
||||
|
||||
private:
|
||||
// Reference to the DataStoreCharger object that holds EVSE data
|
||||
data::DataStoreCharger& m_dataobj;
|
||||
std::shared_ptr<rpc::JsonRpc2ServerWithClient> m_rpc_server;
|
||||
int m_precision = 3;
|
||||
};
|
||||
|
||||
} // namespace notifications
|
||||
|
||||
#endif // NOTIFICATIONS_CHARGEPOINT_HPP
|
||||
@@ -0,0 +1,48 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright chargebyte GmbH and Contributors to EVerest
|
||||
#include "Evse.hpp"
|
||||
#include "../RpcHandler.hpp"
|
||||
|
||||
namespace notifications {
|
||||
|
||||
static const std::string NOTIFICATION_EVSE_HWCAPS_CHANGED = "EVSE.HardwareCapabilitiesChanged";
|
||||
static const std::string NOTIFICATION_EVSE_STATUS_CHANGED = "EVSE.StatusChanged";
|
||||
static const std::string NOTIFICATION_EVSE_METER_DATA_CHANGED = "EVSE.MeterDataChanged";
|
||||
|
||||
Evse::Evse(std::shared_ptr<rpc::JsonRpc2ServerWithClient> rpc_server, data::DataStoreCharger& dataobj, int precision) :
|
||||
m_dataobj(dataobj), m_rpc_server(std::move(rpc_server)), m_precision(precision) {
|
||||
for (const auto& evse : m_dataobj.evses) {
|
||||
const int32_t index = evse->evseinfo.get_index();
|
||||
evse->hardwarecapabilities.register_notification_callback(
|
||||
[this, index](const RPCDataTypes::HardwareCapabilitiesObj& data) {
|
||||
this->send_hardware_capabilities_changed(index, data);
|
||||
});
|
||||
evse->evsestatus.register_notification_callback(
|
||||
[this, index](const RPCDataTypes::EVSEStatusObj& data) { this->send_status_changed(index, data); });
|
||||
evse->meterdata.register_notification_callback(
|
||||
[this, index](const RPCDataTypes::MeterDataObj& data) { this->send_meterdata_changed(index, data); });
|
||||
}
|
||||
};
|
||||
|
||||
// Notifications
|
||||
|
||||
void Evse::send_hardware_capabilities_changed(int32_t evse_index, const RPCDataTypes::HardwareCapabilitiesObj& hwcap) {
|
||||
RPCDataTypes::EVSEHardwareCapabilitiesChangedObj hwcap_changed;
|
||||
hwcap_changed.evse_index = evse_index;
|
||||
hwcap_changed.hardware_capabilities = hwcap;
|
||||
m_rpc_server->CallNotificationWithObject(NOTIFICATION_EVSE_HWCAPS_CHANGED, hwcap_changed, m_precision);
|
||||
}
|
||||
void Evse::send_status_changed(int32_t evse_index, const RPCDataTypes::EVSEStatusObj& status) {
|
||||
RPCDataTypes::EVSEStatusChangedObj status_changed;
|
||||
status_changed.evse_index = evse_index;
|
||||
status_changed.evse_status = status;
|
||||
m_rpc_server->CallNotificationWithObject(NOTIFICATION_EVSE_STATUS_CHANGED, status_changed, m_precision);
|
||||
}
|
||||
void Evse::send_meterdata_changed(int32_t evse_index, const RPCDataTypes::MeterDataObj& meter) {
|
||||
RPCDataTypes::EVSEMeterDataChangedObj meter_changed;
|
||||
meter_changed.evse_index = evse_index;
|
||||
meter_changed.meter_data = meter;
|
||||
m_rpc_server->CallNotificationWithObject(NOTIFICATION_EVSE_METER_DATA_CHANGED, meter_changed, m_precision);
|
||||
}
|
||||
|
||||
} // namespace notifications
|
||||
@@ -0,0 +1,42 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright chargebyte GmbH and Contributors to EVerest
|
||||
#ifndef NOTIFICATIONS_EVSE_HPP
|
||||
#define NOTIFICATIONS_EVSE_HPP
|
||||
|
||||
#include "../../data/DataStore.hpp"
|
||||
#include <jsonrpccxx/client.hpp>
|
||||
|
||||
namespace RPCDataTypes = types::json_rpc_api;
|
||||
|
||||
// forward declaration
|
||||
namespace rpc {
|
||||
class JsonRpc2ServerWithClient;
|
||||
}
|
||||
|
||||
namespace notifications {
|
||||
|
||||
class Evse {
|
||||
public:
|
||||
// Constructor and Destructor
|
||||
// Deleting the default constructor to ensure the class is always initialized with a DataStoreCharger object
|
||||
Evse() = delete;
|
||||
// This needs to take a copy of rpc_server for reference counting, not a reference to it
|
||||
Evse(std::shared_ptr<rpc::JsonRpc2ServerWithClient> rpc_server, data::DataStoreCharger& dataobj, int precision = 3);
|
||||
~Evse() = default;
|
||||
|
||||
// Notifications
|
||||
|
||||
void send_hardware_capabilities_changed(int32_t evse_index, const RPCDataTypes::HardwareCapabilitiesObj& hwcap);
|
||||
void send_status_changed(int32_t evse_index, const RPCDataTypes::EVSEStatusObj& status);
|
||||
void send_meterdata_changed(int32_t evse_index, const RPCDataTypes::MeterDataObj& meter);
|
||||
|
||||
private:
|
||||
// Reference to the DataStoreCharger object that holds EVSE data
|
||||
data::DataStoreCharger& m_dataobj;
|
||||
std::shared_ptr<rpc::JsonRpc2ServerWithClient> m_rpc_server;
|
||||
int m_precision = 3;
|
||||
};
|
||||
|
||||
} // namespace notifications
|
||||
|
||||
#endif // NOTIFICATIONS_EVSE_HPP
|
||||
Reference in New Issue
Block a user