Files
qt5-legatus-legacy/Lts/Services/AudioVideoManagement/AvsCommands/set_rt_profile_base.cpp
T
2026-08-13 18:33:10 +02:00

67 lines
1.3 KiB
C++
Executable File

/**
* @RDE_HEADER@
* SetRtProfileBase
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Fröbel, NLE, 2018-12-17
*/
#include "set_rt_profile_base.h"
#include <AudioVideoManagement/iava_comm.h>
#include <QtGlobal>
namespace AudioVideoManagement
{
namespace AvaCommands
{
SetRtProfileBase::SetRtProfileBase(IAvaComm *comm)
: m_comm(comm)
, m_collector(comm, [this] (QVector<QString> &&invalidNames) { onInvalidNameListReceived(std::move(invalidNames)); })
{
Q_ASSERT(comm);
}
void SetRtProfileBase::connectToComm()
{
connect(m_comm, &IAvaComm::ok, this, &SetRtProfileBase::onOk);
m_collector.start();
}
void SetRtProfileBase::disconnectFromComm()
{
m_comm->disconnect(this);
}
void SetRtProfileBase::sendCommand(const QString &cmd)
{
m_comm->sendPreparedCommand(cmd);
}
bool SetRtProfileBase::nullifies(ICommand *other) const
{
Q_ASSERT(other);
SetRtProfileBase *other_ = dynamic_cast<SetRtProfileBase*>(other);
if (!other_)
return false;
return true;
}
void SetRtProfileBase::onOk()
{
Q_ASSERT(!m_ok);
m_ok = true;
}
void SetRtProfileBase::onInvalidNameListReceived(QVector<QString> &&invalidNames)
{
Q_ASSERT(m_ok);
Q_ASSERT(!m_invalidNames);
m_invalidNames = std::move(invalidNames);
done();
}
}} // namespace AudioVideoManagement::AvaCommands