/** * @RDE_HEADER@ * QueryTimeline * $Id$ * $HeadURL$ * $Author$ * Created by Christian Fröbel, SLSE, 2017-07-10 */ #include "query_timeline.h" #include "iava_comm.h" #include "iava_command_done_observer.h" #include "av_helper.h" namespace AudioVideoManagement { namespace AvaCommands { QueryTimeline::QueryTimeline(IAvaComm *comm, IAvaCommandDoneObserver *observer, const QString &streamName, const boost::optional &start, const boost::optional &end) : m_streamName(streamName) , m_collector(comm, streamName, [this] (AvaTimeline &&timeline) { onTimelineReceived(std::move(timeline)); }, [this] { m_observer->alive(this); }) , m_comm(comm) , m_observer(observer) , m_start(start) , m_end(end) { Q_ASSERT(comm); Q_ASSERT(observer); } void QueryTimeline::send() { connect(m_comm, &IAvaComm::ok, this, &QueryTimeline::onOk); m_collector.start(); m_comm->queryTimeline(m_streamName, m_start, m_end); } void QueryTimeline::onOk() { Q_ASSERT(!m_ok); m_ok = true; } void QueryTimeline::done() { m_comm->disconnect(this); m_observer->done(this); } void QueryTimeline::onTimelineReceived(AvaTimeline &&timeline) { Q_ASSERT(m_ok); m_timeline = std::move(timeline); done(); } } // namespace AvaCommands } // namespace AudioVideoManagement