72 lines
1.8 KiB
C++
Executable File
72 lines
1.8 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* SetAnnouncementProfile
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Astrid Mueller, SGAS, 2017-11-30
|
|
*/
|
|
|
|
#include "set_announcement_profile.h"
|
|
#include <AudioVideoManagement/iava_comm.h>
|
|
#include <AudioVideoManagement/iava_command_done_observer.h>
|
|
#include <AudioVideoManagement/av_helper.h>
|
|
#include <AudioVideoManagement/rt_state.h>
|
|
|
|
|
|
namespace AudioVideoManagement
|
|
{
|
|
|
|
namespace AvaCommands
|
|
{
|
|
|
|
SetAnnouncementProfile::SetAnnouncementProfile(IAvaComm *comm, IAvaCommandDoneObserver *observer, RtState *rtState, const QString &menuDef, const QString &identityList, const QString &stateList)
|
|
: m_menuDef(menuDef)
|
|
, m_identityList(identityList)
|
|
, m_stateList(stateList)
|
|
, m_collector(comm, [this] (QVector<QString> &&invalidNames) { onInvalidNameListReceived(std::move(invalidNames)); })
|
|
, m_comm(comm)
|
|
, m_observer(observer)
|
|
, m_rtState(rtState)
|
|
{
|
|
Q_ASSERT(comm);
|
|
Q_ASSERT(observer);
|
|
Q_ASSERT(rtState);
|
|
}
|
|
|
|
void SetAnnouncementProfile::send()
|
|
{
|
|
connect(m_comm, &IAvaComm::ok, this, &SetAnnouncementProfile::onOk);
|
|
connect(m_comm, &IAvaComm::sumChannelStateReceived, this, &SetAnnouncementProfile::onSumChannelStateReceived);
|
|
m_collector.start();
|
|
m_comm->setAnnouncementProfile(m_rtState->sumChannel(), m_menuDef, m_identityList, m_stateList);
|
|
}
|
|
|
|
void SetAnnouncementProfile::onOk()
|
|
{
|
|
Q_ASSERT(!m_ok);
|
|
m_ok = true;
|
|
}
|
|
|
|
void SetAnnouncementProfile::onSumChannelStateReceived(AvaSumChannel)
|
|
{
|
|
Q_ASSERT(m_invalidNames);
|
|
done();
|
|
}
|
|
|
|
void SetAnnouncementProfile::done()
|
|
{
|
|
m_comm->disconnect(this);
|
|
m_observer->done(this);
|
|
}
|
|
|
|
void SetAnnouncementProfile::onInvalidNameListReceived(QVector<QString> &&invalidNames)
|
|
{
|
|
Q_ASSERT(m_ok);
|
|
Q_ASSERT(!m_invalidNames);
|
|
m_invalidNames = std::move(invalidNames);
|
|
}
|
|
|
|
} // namespace AvaCommands
|
|
} // namespace AudioVideoManagement
|