Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+99
View File
@@ -0,0 +1,99 @@
/**
* @RDE_HEADER@
* Api for BSM access
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2017-01-26
*/
#include "bsm_api.h"
#include "bsm_socket_handler.h"
namespace BuildingControlUnit
{
namespace BSM
{
Api::Api(QObject *parent)
: QObject(parent)
, m_socketHandler(new SocketHandler(this))
, m_logger(BuildingControlUnit::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);
}
} // namespace BSM
} // namespace BuildingControlUnit