/** * @RDE_HEADER@ * SetAnnouncementProfile * $Id$ * $HeadURL$ * $Author$ * Created by Astrid Mueller, SGAS, 2017-11-30 */ #include "set_announcement_profile.h" #include #include #include #include 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 &&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 &&invalidNames) { Q_ASSERT(m_ok); Q_ASSERT(!m_invalidNames); m_invalidNames = std::move(invalidNames); } } // namespace AvaCommands } // namespace AudioVideoManagement