Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/Buildings/BuildingControlUnit/BSM/bsm_api.cpp
T
berrux-dev 9c1ac7cbef Merge feature/lts-viewer-validation-testing-phase into feature/qt6-migration-basis-modules-merge
Resolves 1 conflict (new_docker_build.sh, union of viewer-only + codification options); folds in fixes for pre-existing defects surfaced by the validation runs (KDReports-qt6 wiring, LtsSession RTI linking, LtsFileDialog/WLS/BSM Qt6/RTI API migration, GROUP4 target list, new --cmake_build_flags option); validated with BUILD_RTI=ON BUILD_GRANTLEE=ON in 3 Docker runs (run 3: build green, 6 base-state first-run CTest failures documented).
2026-09-27 07:33:29 +02:00

95 lines
2.9 KiB
C++
Executable File

#include "bsm_api.h"
#include "bsm_socket_handler.h"
#include <TrainingAreaBase/logger.h>
namespace BuildingControlUnit
{
namespace BSM
{
Api::Api(QObject *parent)
: QObject(parent)
, m_socketHandler(new SocketHandler(this))
, m_logger(TrainingAreaBase::getLogger("BSM.Api"))
{
connect(m_socketHandler, &SocketHandler::opticalShot,
this, &Api::opticalShot);
connect(m_socketHandler, &SocketHandler::opticalShotOC,
this, &Api::opticalShotOC);
connect(m_socketHandler, &SocketHandler::bsmStateChanged,
this, &Api::bsmStateChanged);
}
Api::~Api()
{
delete m_socketHandler;
}
bool Api::init(const BuildingBsmConfig &bsmConfig)
{
return m_socketHandler->init(bsmConfig);
}
bool Api::triggerFlashlight(int bsmId, const QString &hostname, int numberOfFlashes, int pauseBetweenFlashesSec)
{
DEBUG_LOG(m_logger) << "triggerFlashlight bsmId=" << bsmId
<< " hostname=" << hostname
<< " numberOfFlashes=" << numberOfFlashes
<< " pauseBetweenFlashesSec=" << pauseBetweenFlashesSec;
return m_socketHandler->triggerFlashlight(bsmId, hostname, numberOfFlashes, pauseBetweenFlashesSec);
}
bool Api::triggerFlashlightPulse(int bsmId, const QString &hostname,
int numberOfFlashes,
int pauseDuration,
int choppedConfiguration,
int flashDuration)
{
DEBUG_LOG(m_logger) << "triggerFlashlightPulse bsmId=" << bsmId
<< " hostname=" << hostname
<< " numberOfFlashes=" << numberOfFlashes
<< " pauseDuration=" << pauseDuration
<< " choppedConfiguration=" << choppedConfiguration
<< " flashDuration=" << flashDuration;
return m_socketHandler->triggerFlashlightPulse(bsmId, hostname, numberOfFlashes, pauseDuration, choppedConfiguration, flashDuration);
}
bool Api::triggerFlashlights( int numberOfFlashes,
int pauseDuration,
int choppedConfiguration,
int flashDuration)
{
DEBUG_LOG(m_logger) << "triggerFlashlights numberOfFlashes=" << numberOfFlashes
<< " pauseDuration=" << pauseDuration
<< " choppedConfiguration" << choppedConfiguration
<< " flashDuration=" << flashDuration;
return m_socketHandler->triggerFlashlights( numberOfFlashes, pauseDuration, choppedConfiguration, flashDuration);
}
QVector<BsmState> Api::bsmStates() const
{
return m_socketHandler->bsmStates();
}
bool Api::getBsmConfiguration(int bsmId)
{
return m_socketHandler->getBsmConfiguration(bsmId);
}
bool Api::getBsmBitTimeout(int bsmId)
{
return m_socketHandler->getBsmBitTimeout(bsmId);
}
bool Api::getBsmTechnicalStatus(int bsmId)
{
return m_socketHandler->getBsmTechnicalStatus(bsmId);
}
}
}