67 lines
1.7 KiB
C++
Executable File
67 lines
1.7 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* ISM Object Sound Area
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Filip Biedziak, NLE, 2020-08-05
|
|
*/
|
|
|
|
#include "object_effect_area.h"
|
|
|
|
|
|
namespace InfrastructureManagement
|
|
{
|
|
|
|
ObjectEffectArea::ObjectEffectArea(MainHandler *mainHandler)
|
|
: Base(mainHandler, getLogger("ObjectEffectArea"))
|
|
{
|
|
}
|
|
|
|
ObjectEffectArea::~ObjectEffectArea()
|
|
{
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------------------------------------------------------
|
|
Core::FunctionReplyObject ObjectEffectArea::createObject(const EffectArea &data)
|
|
{
|
|
m_data = data;
|
|
m_data.name("Sound Area " + std::to_string(m_data.id()));
|
|
|
|
onPublishData(); // publish data via DDS
|
|
|
|
return Core::FunctionReplyObject(m_data.id());
|
|
}
|
|
|
|
Core::FunctionReplyObject ObjectEffectArea::updateObject(const EffectArea &data)
|
|
{
|
|
m_data = data;
|
|
DEBUG_LOG(m_logger) << "Data changed for Id: " << m_data.id();
|
|
|
|
onPublishData(); // publish data via DTS
|
|
|
|
return Core::FunctionReplyObject(m_data.id());
|
|
}
|
|
|
|
Core::FunctionReplyObject ObjectEffectArea::removeObject()
|
|
{
|
|
if (!dts()->removeEffectAreaByKey(m_data.id()))
|
|
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "EffectArea with id %1 can not be removed from DDS")).arg(m_data.id());
|
|
|
|
return Core::FunctionReplyObject(m_data.id());
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------------------------------------------------------
|
|
void ObjectEffectArea::onPublishData()
|
|
{
|
|
INFO_LOG(m_logger) << "Publish IsmEffectArea-data to dds (" << m_data.id() << ") ...";
|
|
|
|
if (!dts()->publish(m_data))
|
|
ERROR_LOG(m_logger) << "Error publishing IsmEffectArea-data to dds";
|
|
}
|
|
|
|
} // namespace InfrastructureManagement
|
|
|