OutputHandler cleaned

This commit is contained in:
2026-07-23 16:48:21 +02:00
parent c354025813
commit 4f60fddd64
2 changed files with 24 additions and 6 deletions
+2
View File
@@ -68,12 +68,14 @@ void InputHandler::pullSPValue() {
Event event = {EventType::SP_VALUE, SPValue};
eventBus.publish(event);
}
void InputHandler::pullTemperatureValue() {
midas::odb o(this->path);
float temperatureValue = o[temperatureIndex];
Event event = {EventType::TEMPERATURE_VALUE, temperatureValue};
eventBus.publish(event);
}
void InputHandler::pullPowerValue() {
midas::odb o(this->path);
float powerValue = o[powerIndex];
+22 -6
View File
@@ -3,6 +3,7 @@
#include "OutputHandlerConfig.h"
#include "PressureCalculator.h"
#include "SettingsHandler.h"
#include "tmfe.h"
#include <string>
void OutputHandler::enableSetPressure(bool enable) {
@@ -27,13 +28,28 @@ void OutputHandler::setEquipmentPath(std::string equipmentName) {
}
void OutputHandler::update() {
if (isSetPressureEnable) {
midas::odb o(equipmentPath);
if (o.exists(OutputHandlerConfig::OUTPUT_VARIABLE)) {
o(OutputHandlerConfig::OUTPUT_VARIABLE)[outputPressureSPIndex] =
pressure;
}
bool isKeyValid = true;
midas::odb o(equipmentPath);
if (o.exists(OutputHandlerConfig::OUTPUT_VARIABLE)) {
TMFE::Instance()->Msg(MERROR, __FUNCTION__, "Key at %s doesn't exists",
equipmentPath.c_str());
isKeyValid = false;
}
if (o.size() < outputPressureSPIndex) {
TMFE::Instance()->Msg(MERROR, __FUNCTION__,
"SP index is %i, where array size is %i.",
outputPressureSPIndex, o.size());
isKeyValid = false;
}
//// SHOULD I CRASH IF KEY NOT VALID ?
//// FOR NOW, FAILED SILENTLY
if (isSetPressureEnable && isKeyValid)
o(OutputHandlerConfig::OUTPUT_VARIABLE)[outputPressureSPIndex] =
pressure;
}
OutputHandler::OutputHandler(EventBus &eventBusReference) {