Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+44
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ChangeRtProfileCircuitName
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLE, 2018-12-17
|
||||
*/
|
||||
|
||||
#include "change_rt_profile_circuit_name.h"
|
||||
#include <AudioVideoManagement/iava_command_done_observer.h>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
ChangeRtProfileCircuitName::ChangeRtProfileCircuitName(IAvaComm *comm, IAvaCommandDoneObserver *observer, RtState *rtState, const RtState::RadioCircuit &radioCircuit)
|
||||
: SetRtProfileBase(comm)
|
||||
, m_radioCircuit(radioCircuit)
|
||||
, m_rtState(rtState)
|
||||
, m_observer(observer)
|
||||
{
|
||||
Q_ASSERT(observer);
|
||||
Q_ASSERT(rtState);
|
||||
}
|
||||
|
||||
void ChangeRtProfileCircuitName::send()
|
||||
{
|
||||
connectToComm();
|
||||
|
||||
m_rtState->changeName(m_radioCircuit);
|
||||
sendCommand(QString::fromStdString(m_rtState->toCommand()));
|
||||
}
|
||||
|
||||
void ChangeRtProfileCircuitName::done()
|
||||
{
|
||||
disconnectFromComm();
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ChangeRtProfileCircuitName
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLE, 2018-12-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "set_rt_profile_base.h"
|
||||
#include <AudioVideoManagement/rt_state.h>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Christian Fröbel
|
||||
*/
|
||||
class ChangeRtProfileCircuitName final : public SetRtProfileBase
|
||||
{
|
||||
public:
|
||||
ChangeRtProfileCircuitName(IAvaComm *comm, IAvaCommandDoneObserver *observer, RtState *rtState, const RtState::RadioCircuit &radioCircuit);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("ChangeRtProfileCircuitName"); }
|
||||
|
||||
protected:
|
||||
void done() override;
|
||||
|
||||
private:
|
||||
const RtState::RadioCircuit m_radioCircuit;
|
||||
RtState *m_rtState;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
};
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ChooseStream
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, SLSE, 2017-06-29
|
||||
*/
|
||||
|
||||
#include "choose_stream.h"
|
||||
#include "iava_comm.h"
|
||||
#include "iava_command_done_observer.h"
|
||||
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
ChooseStream::ChooseStream(IAvaComm *comm, IAvaCommandDoneObserver *doneObserver, const QString &dialogId, const QString &streamName)
|
||||
: m_dialogId(dialogId)
|
||||
, m_streamName(streamName)
|
||||
, m_comm(comm)
|
||||
, m_observer(doneObserver)
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(doneObserver);
|
||||
}
|
||||
|
||||
void ChooseStream::send()
|
||||
{
|
||||
connect(m_comm, &IAvaComm::streamInfoReceived, this, &ChooseStream::onStreamInfoReceived);
|
||||
connect(m_comm, &IAvaComm::streamStateReceived, this, &ChooseStream::onStreamStateReceived);
|
||||
connect(m_comm, &IAvaComm::streamModeReceived, this, &ChooseStream::onStreamModeReceived);
|
||||
bool muted = true;
|
||||
m_comm->chooseStream(m_dialogId, m_streamName, muted);
|
||||
}
|
||||
|
||||
void ChooseStream::onStreamInfoReceived(const QString &dialogId, const QString &streamName, const AvaStreamInfo &streamInfo)
|
||||
{
|
||||
Q_ASSERT(dialogId == m_dialogId);
|
||||
Q_ASSERT(streamName == m_streamName);
|
||||
Q_ASSERT(!m_streamInfo);
|
||||
m_streamInfo = streamInfo;
|
||||
}
|
||||
|
||||
void ChooseStream::onStreamStateReceived(const QString &dialogId, const QString &streamName, AvaStreamState streamState)
|
||||
{
|
||||
Q_ASSERT(dialogId == m_dialogId);
|
||||
|
||||
// There can be multiple StreamStates for every stream that was active.
|
||||
// But all come prior to StreamInfo
|
||||
if (!m_streamInfo)
|
||||
return;
|
||||
|
||||
Q_ASSERT(streamName == m_streamName);
|
||||
Q_ASSERT(!m_streamState);
|
||||
m_streamState = streamState;
|
||||
}
|
||||
|
||||
void ChooseStream::onStreamModeReceived(const QString &dialogId, const QString &streamName, bool pint, bool autoStop)
|
||||
{
|
||||
Q_UNUSED(pint);
|
||||
Q_UNUSED(autoStop);
|
||||
Q_ASSERT(dialogId == m_dialogId);
|
||||
Q_ASSERT(streamName == m_streamName);
|
||||
Q_ASSERT(m_streamInfo);
|
||||
Q_ASSERT(m_streamState);
|
||||
done();
|
||||
}
|
||||
|
||||
void ChooseStream::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ChooseStream
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, SLSE, 2017-06-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AudioVideoManagement/icommand.h>
|
||||
#include <AudioVideoManagement/ava_types.h>
|
||||
#include <AudioVideoManagement/avm_export.h>
|
||||
#include <QString>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* Example protocol for chooseStream:
|
||||
* @code
|
||||
* ==> b'chooseStream "av_0045" 1 "CTCVideo-1"\n'
|
||||
* <== b'200 OK\r\n'
|
||||
* <== b'221 "av_0040" "CTCVideo-1" 1523026547.94 STREAMPOS\r\n' -- for each previously active stream
|
||||
* <== b'221 "av_0053" "CTCVideo-1" 1523026547.94 STREAMPOS\r\n'
|
||||
* <== b'221 "av_0045" "CTCVideo-1" 1523026547.94 STREAMPOS\r\n'
|
||||
* <== b'221 "av_0036" "CTCVideo-1" 1523026547.94 STREAMPOS\r\n'
|
||||
* <== b'223 "av_0036" "CTCVideo-1" 3 STREAMSTATE\r\n' -- for each previously active video *and* audio stream
|
||||
* <== b'223 "av_0040" "CTCVideo-1" 3 STREAMSTATE\r\n'
|
||||
* <== b'223 "av_0045" "CTCVideo-1" 3 STREAMSTATE\r\n'
|
||||
* <== b'223 "av_0053" "CTCVideo-1" 3 STREAMSTATE\r\n'
|
||||
* <== b'223 "av_0040" "CTCVideo-1" 3 STREAMSTATE\r\n'
|
||||
* <== b'223 "av_0053" "CTCVideo-1" 3 STREAMSTATE\r\n'
|
||||
* <== b'223 "av_0045" "CTCVideo-1" 3 STREAMSTATE\r\n'
|
||||
* <== b'223 "av_0036" "CTCVideo-1" 3 STREAMSTATE\r\n'
|
||||
* <== b'220 "av_0045" "CTCVideo-1" 1523026548.00 1523026548.00 0.00 STREAMINFO\r\n' -- for the newly chosen stream
|
||||
* <== b'221 "av_0045" "CTCVideo-1" 1523026548.00 STREAMPOS\r\n'
|
||||
* <== b'222 "av_0045" "CTCVideo-1" 100 STREAMSPEED\r\n'
|
||||
* <== b'223 "av_0045" "CTCVideo-1" 0 STREAMSTATE\r\n'
|
||||
* <== b'224 "av_0045" "CTCVideo-1" 1 0 STREAMMODE\r\n'
|
||||
* <== b'225 "av_0045" "CTCVideo-1" 1 STREAMAUDIOMUTE\r\n' -- optional, in case the stream has an audio part
|
||||
* <== b'228 "av_0045" "CTCVideo-1" 1 STREAMVOLUMECHANGED\r\n'
|
||||
* <== b'225 "av_0045" "CTCVideo-1" 1 STREAMAUDIOMUTE\r\n'
|
||||
* <== b'223 "av_0045" "CTCVideo-1" 1 STREAMSTATE\r\n'
|
||||
* @endcode
|
||||
*
|
||||
* The order of those responses is deterministic.
|
||||
* See AVS-Software src/app/AVS_Workstation/app/presentationgroup.cpp:
|
||||
* int PresentationGroup::sendInfo(QString stream, int type)
|
||||
*
|
||||
* So we synchronize on the StreamMode response as everything thereafter is optional.
|
||||
*
|
||||
* @author Christian Fröbel
|
||||
*/
|
||||
class AVM_COMMON_EXPORT ChooseStream final : public ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChooseStream(IAvaComm *comm, IAvaCommandDoneObserver *doneObserver, const QString &dialogId, const QString &streamName);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("ChooseStream: ") + m_streamName; }
|
||||
|
||||
/**
|
||||
* May only be called after the command has successfully completed.
|
||||
*/
|
||||
///{@
|
||||
AvaStreamInfo streamInfo() const { return *m_streamInfo; }
|
||||
AvaStreamState streamState() const { return *m_streamState; }
|
||||
///@}
|
||||
|
||||
private slots:
|
||||
void onStreamInfoReceived(const QString &dialogId, const QString &streamName, const AvaStreamInfo &streamInfo);
|
||||
void onStreamStateReceived(const QString &dialogId, const QString &streamName, AvaStreamState streamState);
|
||||
void onStreamModeReceived(const QString &dialogId, const QString &streamName, bool pint, bool autoStop);
|
||||
|
||||
private:
|
||||
void done();
|
||||
|
||||
const QString m_dialogId;
|
||||
const QString m_streamName;
|
||||
boost::optional<AvaStreamInfo> m_streamInfo;
|
||||
boost::optional<AvaStreamState> m_streamState;
|
||||
IAvaComm *m_comm;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
};
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ChooseStreamOverview
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLSE, 2018-03-28
|
||||
*/
|
||||
|
||||
#include "choose_stream_overview.h"
|
||||
#include <AudioVideoManagement/iava_comm.h>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
ChooseStreamOverview::ChooseStreamOverview(IAvaComm *comm, IAvaCommandDoneObserver *observer, const QString &dialogId, const QStringList &streamNames, bool muted)
|
||||
: SimpleCommand(QLatin1String("ChooseStreamOverview"), comm, observer, [=] (IAvaComm *comm) { comm->chooseStreamOverview(dialogId, streamNames, muted); } )
|
||||
, m_dialogId(dialogId)
|
||||
{
|
||||
}
|
||||
|
||||
bool ChooseStreamOverview::nullifies(ICommand *other) const
|
||||
{
|
||||
Q_ASSERT(other);
|
||||
|
||||
ChooseStreamOverview *other_ = dynamic_cast<ChooseStreamOverview*>(other);
|
||||
if (!other_)
|
||||
return false;
|
||||
|
||||
return m_dialogId == other_->m_dialogId;
|
||||
}
|
||||
|
||||
} // namespace AvaCommands
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ChooseStreamOverview
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLSE, 2018-03-28
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "simple_command.h"
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Christian Fröbel
|
||||
*/
|
||||
class ChooseStreamOverview final : public SimpleCommand
|
||||
{
|
||||
public:
|
||||
ChooseStreamOverview(IAvaComm *comm, IAvaCommandDoneObserver *observer, const QString &dialogId, const QStringList &streamNames, bool muted);
|
||||
|
||||
bool nullifies(ICommand *other) const override;
|
||||
|
||||
private:
|
||||
const QString m_dialogId;
|
||||
};
|
||||
|
||||
} // namespace AvaCommands
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GetElokaList
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, SLSE, 2017-10-23
|
||||
*/
|
||||
|
||||
#include "get_eloka_list.h"
|
||||
#include "iava_comm.h"
|
||||
#include "iava_command_done_observer.h"
|
||||
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
GetElokaList::GetElokaList(IAvaComm *comm, IAvaCommandDoneObserver *observer, const QString &streamName)
|
||||
: m_streamName(streamName)
|
||||
, m_collector(comm, [this] (QVector<QString> &&elokaSignals) { onElokaListReceived(std::move(elokaSignals)); })
|
||||
, m_comm(comm)
|
||||
, m_observer(observer)
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(observer);
|
||||
}
|
||||
|
||||
void GetElokaList::send()
|
||||
{
|
||||
connect(m_comm, &IAvaComm::ok, this, &GetElokaList::onOk);
|
||||
m_collector.start();
|
||||
m_comm->getElokaList(m_streamName);
|
||||
}
|
||||
|
||||
void GetElokaList::onOk()
|
||||
{
|
||||
Q_ASSERT(!m_ok);
|
||||
m_ok = true;
|
||||
}
|
||||
|
||||
void GetElokaList::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
void GetElokaList::onElokaListReceived(QVector<QString> &&elokaSignals)
|
||||
{
|
||||
Q_ASSERT(m_ok);
|
||||
m_elokaSignals = std::move(elokaSignals);
|
||||
done();
|
||||
}
|
||||
|
||||
} // namespace AvaCommands
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GetElokaList
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, SLSE, 2017-10-23
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AudioVideoManagement/icommand.h>
|
||||
#include <AudioVideoManagement/list_response_collector.h>
|
||||
#include <QVector>
|
||||
#include <QString>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Christian Fröbel
|
||||
*/
|
||||
class GetElokaList final : public ICommand
|
||||
{
|
||||
public:
|
||||
GetElokaList(IAvaComm *comm, IAvaCommandDoneObserver *observer, const QString &streamName);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("GetElokaList"); }
|
||||
|
||||
const QVector<QString> &elokaSignals() const { return m_elokaSignals; }
|
||||
|
||||
private slots:
|
||||
void onOk();
|
||||
|
||||
private:
|
||||
void done();
|
||||
void onElokaListReceived(QVector<QString> &&elokaSignals);
|
||||
|
||||
const QString m_streamName;
|
||||
bool m_ok{false};
|
||||
QVector<QString> m_elokaSignals; //!< available ELOKA-signals
|
||||
ElokaListCollector m_collector;
|
||||
IAvaComm *m_comm;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
};
|
||||
|
||||
} // namespace AvaCommands
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GetStreamList
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, SLSE, 2017-06-29
|
||||
*/
|
||||
|
||||
#include "get_stream_list.h"
|
||||
#include "iava_comm.h"
|
||||
#include "iava_command_done_observer.h"
|
||||
#include <QtGlobal>
|
||||
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
GetStreamList::GetStreamList(IAvaComm *comm, IAvaCommandDoneObserver *observer, AvaStreamType streamType, AvaStreamSource streamSource, StreamNameMapping *streamNameMapping)
|
||||
: m_streamType(streamType)
|
||||
, m_streamSource(streamSource)
|
||||
, m_collector(comm, [this] (QVector<AvaStream> &&streams) { onStreamListReceived(std::move(streams)); }, StreamListElementFactory(streamType, streamSource, streamNameMapping))
|
||||
, m_comm(comm)
|
||||
, m_observer(observer)
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(observer);
|
||||
}
|
||||
|
||||
void GetStreamList::send()
|
||||
{
|
||||
m_collector.start();
|
||||
m_comm->getStreamList(m_streamType, m_streamSource);
|
||||
}
|
||||
|
||||
void GetStreamList::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
void GetStreamList::onStreamListReceived(QVector<AvaStream> &&streams)
|
||||
{
|
||||
m_streams = std::move(streams);
|
||||
done();
|
||||
}
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GetStreamList
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, SLSE, 2017-06-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "icommand.h"
|
||||
#include <AudioVideoManagement/ava_types.h>
|
||||
#include <AudioVideoManagement/list_response_collector.h>
|
||||
#include <QVector>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
class StreamNameMapping;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Christian Fröbel
|
||||
*/
|
||||
class GetStreamList final : public ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GetStreamList(IAvaComm *comm, IAvaCommandDoneObserver *observer, AvaStreamType, AvaStreamSource, StreamNameMapping *streamNameMapping);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("GetStreamList"); }
|
||||
|
||||
const QVector<AvaStream> &streams() const { return m_streams; }
|
||||
|
||||
private:
|
||||
void done();
|
||||
void onStreamListReceived(QVector<AvaStream> &&streams);
|
||||
|
||||
const AvaStreamType m_streamType;
|
||||
const AvaStreamSource m_streamSource;
|
||||
QVector<AvaStream> m_streams;
|
||||
StreamListCollector m_collector;
|
||||
IAvaComm *m_comm;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
};
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* KeepAlive
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLSE, 2018-04-10
|
||||
*/
|
||||
|
||||
#include "keep_alive.h"
|
||||
#include "iava_comm.h"
|
||||
#include "iava_command_done_observer.h"
|
||||
#include "ivd_comm.h"
|
||||
#include "ivd_command_done_observer.h"
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<class Comm, class DoneObserver>
|
||||
KeepAlive<Comm, DoneObserver>::KeepAlive(Comm *comm, DoneObserver *doneObserver)
|
||||
: m_comm(comm)
|
||||
, m_observer(doneObserver)
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(doneObserver);
|
||||
}
|
||||
|
||||
template<class Comm, class DoneObserver>
|
||||
void KeepAlive<Comm, DoneObserver>::send()
|
||||
{
|
||||
connect(m_comm, &Comm::keepAliveReceived, this, &KeepAlive::onKeepAliveReceived);
|
||||
m_comm->keepAlive();
|
||||
}
|
||||
|
||||
template<class Comm, class DoneObserver>
|
||||
void KeepAlive<Comm, DoneObserver>::onKeepAliveReceived()
|
||||
{
|
||||
done();
|
||||
}
|
||||
|
||||
template<class Comm, class DoneObserver>
|
||||
void KeepAlive<Comm, DoneObserver>::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Explicit template instantiations.
|
||||
*/
|
||||
///@{
|
||||
template class KeepAlive<IAvaComm, IAvaCommandDoneObserver>;
|
||||
template class KeepAlive<IVdComm, IVdCommandDoneObserver>;
|
||||
///@}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* KeepAlive
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLSE, 2018-04-10
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "icommand.h"
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
/**
|
||||
* Implementation used for KeepAlives on both, RCP_AVA and RCP_VD.
|
||||
*
|
||||
* @author Christian Fröbel
|
||||
*/
|
||||
template<class Comm, class DoneObserver>
|
||||
class KeepAlive final : public ICommand
|
||||
{
|
||||
public:
|
||||
KeepAlive(Comm *comm, DoneObserver *doneObserver);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("KeepAlive"); }
|
||||
|
||||
private slots:
|
||||
void onKeepAliveReceived();
|
||||
|
||||
private:
|
||||
void done();
|
||||
|
||||
Comm *m_comm;
|
||||
DoneObserver *m_observer;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
using KeepAlive = detail::KeepAlive<IAvaComm, IAvaCommandDoneObserver>;
|
||||
|
||||
} // namespace AvaCommands
|
||||
|
||||
|
||||
class IVdComm;
|
||||
class IVdCommandDoneObserver;
|
||||
|
||||
namespace VdCommands
|
||||
{
|
||||
|
||||
using KeepAlive = detail::KeepAlive<IVdComm, IVdCommandDoneObserver>;
|
||||
|
||||
} // namespace VdCommands
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* QueryEloka
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Mueller, SGAS, 2017-11-14
|
||||
*/
|
||||
|
||||
#include "query_eloka.h"
|
||||
#include "iava_comm.h"
|
||||
#include "iava_command_done_observer.h"
|
||||
#include "av_helper.h"
|
||||
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
QueryEloka::QueryEloka(IAvaComm *comm, IAvaCommandDoneObserver *observer, AvaQueryElokaMode mode)
|
||||
: m_mode(mode)
|
||||
, m_comm(comm)
|
||||
, m_observer(observer)
|
||||
, m_collector(comm, [this] (QVector<AvaEloka> &&eloka) { onQueryElokaListReceived(std::move(eloka)); })
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(observer);
|
||||
Q_ASSERT(mode != AvaQueryElokaMode::Stop); // queryEloka 0 (aka Stop) is a SimpleCommad; there is no QueryElokaList-response then
|
||||
}
|
||||
|
||||
void QueryEloka::send()
|
||||
{
|
||||
connect(m_comm, &IAvaComm::ok, this, &QueryEloka::onOk);
|
||||
m_collector.start();
|
||||
m_comm->queryEloka(m_mode);
|
||||
}
|
||||
|
||||
void QueryEloka::onOk()
|
||||
{
|
||||
Q_ASSERT(!m_ok);
|
||||
m_ok = true;
|
||||
}
|
||||
|
||||
void QueryEloka::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
void QueryEloka::onQueryElokaListReceived(QVector<AvaEloka> &&eloka)
|
||||
{
|
||||
Q_ASSERT(m_ok);
|
||||
m_eloka = std::move(eloka);
|
||||
done();
|
||||
}
|
||||
|
||||
} // namespace AvaCommands
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* QueryEloka
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Mueller, SGAS, 2017-11-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "icommand.h"
|
||||
#include <AudioVideoManagement/ava_types.h>
|
||||
#include <AudioVideoManagement/list_response_collector.h>
|
||||
#include <QVector>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* Command to issue queryEloka with modes AvaQueryElokaMode::Push or AvaQueryElokaMode::Poll.
|
||||
* When mode is AvaQueryElokaMode::Stop, queryEloka is a SimpleCommand.
|
||||
*
|
||||
* @author Astrid Müller
|
||||
*/
|
||||
class QueryEloka final : public ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QueryEloka(IAvaComm *comm, IAvaCommandDoneObserver *observer, AvaQueryElokaMode mode);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("QueryEloka"); }
|
||||
|
||||
const QVector<AvaEloka> &eloka() const { return m_eloka; }
|
||||
|
||||
private slots:
|
||||
void onOk();
|
||||
|
||||
private:
|
||||
void done();
|
||||
void onQueryElokaListReceived(QVector<AvaEloka> &&eloka);
|
||||
|
||||
const AvaQueryElokaMode m_mode;
|
||||
bool m_ok{false};
|
||||
IAvaComm *m_comm;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
QVector<AvaEloka> m_eloka;
|
||||
QueryElokaListCollector m_collector;
|
||||
};
|
||||
|
||||
} // namespace AvaCommands
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @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<AvaTimePoint> &start, const boost::optional<AvaTimePoint> &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
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* QueryTimeline
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, SLSE, 2017-07-10
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "icommand.h"
|
||||
#include <boost/optional.hpp>
|
||||
#include <AudioVideoManagement/ava_types.h>
|
||||
#include <AudioVideoManagement/list_response_collector.h>
|
||||
#include <QString>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Christian Fröbel
|
||||
*/
|
||||
class QueryTimeline final : public ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QueryTimeline(IAvaComm *comm, IAvaCommandDoneObserver *observer, const QString &streamName,
|
||||
const boost::optional<AvaTimePoint> &start, const boost::optional<AvaTimePoint> &end);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("QueryTimeline"); }
|
||||
|
||||
const AvaTimeline &timeline() const { return m_timeline; }
|
||||
|
||||
private slots:
|
||||
void onOk();
|
||||
|
||||
private:
|
||||
void done();
|
||||
void onTimelineReceived(AvaTimeline &&timeline);
|
||||
|
||||
const QString m_streamName;
|
||||
bool m_ok{false};
|
||||
AvaTimeline m_timeline;
|
||||
TimelineListCollector m_collector;
|
||||
IAvaComm *m_comm;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
boost::optional<AvaTimePoint> m_start;
|
||||
boost::optional<AvaTimePoint> m_end;
|
||||
};
|
||||
|
||||
} // namespace AvaCommands
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetAbsPosition
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLSE, 2018-02-28
|
||||
*/
|
||||
|
||||
#include "set_abs_position.h"
|
||||
#include "iava_comm.h"
|
||||
#include "iava_command_done_observer.h"
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
SetAbsPosition::SetAbsPosition(IAvaComm *comm, IAvaCommandDoneObserver *doneObserver, const QString &dialogId, const QString &streamName, AvaTimePoint pos)
|
||||
: m_dialogId(dialogId)
|
||||
, m_streamName(streamName)
|
||||
, m_pos(pos)
|
||||
, m_comm(comm)
|
||||
, m_observer(doneObserver)
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(doneObserver);
|
||||
}
|
||||
|
||||
void SetAbsPosition::send()
|
||||
{
|
||||
QObject::connect(m_comm, &IAvaComm::ok, this, &SetAbsPosition::onOk);
|
||||
QObject::connect(m_comm, &IAvaComm::streamPositionReceived, this, &SetAbsPosition::onStreamPositionReceived);
|
||||
m_comm->setAbsPosition(m_dialogId, m_streamName, m_pos);
|
||||
}
|
||||
|
||||
bool SetAbsPosition::nullifies(ICommand *other) const
|
||||
{
|
||||
Q_ASSERT(other);
|
||||
SetAbsPosition *other_ = dynamic_cast<SetAbsPosition*>(other);
|
||||
if (!other_)
|
||||
return false;
|
||||
|
||||
if (m_dialogId != other_->m_dialogId)
|
||||
return false;
|
||||
|
||||
if (m_streamName != other_->m_streamName)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetAbsPosition::onOk()
|
||||
{
|
||||
Q_ASSERT(!m_ok);
|
||||
m_ok = true;
|
||||
}
|
||||
|
||||
void SetAbsPosition::onStreamPositionReceived(const QString &dialogId, const QString &streamName, AvaTimePoint)
|
||||
{
|
||||
Q_UNUSED(streamName);
|
||||
|
||||
if (dialogId != m_dialogId)
|
||||
return;
|
||||
|
||||
if (!m_ok)
|
||||
return;
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
void SetAbsPosition::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetAbsPosition
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLSE, 2018-02-28
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AudioVideoManagement/icommand.h>
|
||||
#include <AudioVideoManagement/ava_types.h>
|
||||
#include <AudioVideoManagement/av_helper.h>
|
||||
#include <QString>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Christian Fröbel
|
||||
*/
|
||||
class SetAbsPosition final : public ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SetAbsPosition(IAvaComm *comm, IAvaCommandDoneObserver *doneObserver, const QString &dialogId, const QString &streamName, AvaTimePoint pos);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("SetAbsPosition: ") + m_streamName + QLatin1String(" to ") + toString(m_pos); }
|
||||
bool canTimeout() const override { return true; }
|
||||
|
||||
bool nullifies(ICommand *other) const override;
|
||||
|
||||
private slots:
|
||||
void onOk();
|
||||
void onStreamPositionReceived(const QString &dialogId, const QString &streamName, AvaTimePoint);
|
||||
|
||||
private:
|
||||
void done();
|
||||
|
||||
const QString m_dialogId;
|
||||
const QString m_streamName;
|
||||
const AvaTimePoint m_pos;
|
||||
bool m_ok{false};
|
||||
IAvaComm *m_comm;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
};
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @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
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetAnnouncementProfile
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Mueller, SGAS, 2017-11-30
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "icommand.h"
|
||||
#include <AudioVideoManagement/ava_types.h>
|
||||
#include <AudioVideoManagement/list_response_collector.h>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
class RtState;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Astrid Müller
|
||||
*/
|
||||
class SetAnnouncementProfile final : public ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SetAnnouncementProfile(IAvaComm *comm, IAvaCommandDoneObserver *observer, RtState *rtState, const QString &menuDef, const QString &identityList, const QString &stateList);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("SetAnnouncementProfile"); }
|
||||
|
||||
const QVector<QString> &invalidNameList() const { return *m_invalidNames; }
|
||||
|
||||
private slots:
|
||||
void onOk();
|
||||
void onSumChannelStateReceived(AvaSumChannel);
|
||||
|
||||
private:
|
||||
void done();
|
||||
void onInvalidNameListReceived(QVector<QString> &&invalidNames);
|
||||
|
||||
const QString m_menuDef;
|
||||
const QString m_identityList;
|
||||
const QString m_stateList;
|
||||
bool m_ok{false};
|
||||
boost::optional<QVector<QString>> m_invalidNames;
|
||||
InvalidNameListCollector m_collector;
|
||||
IAvaComm *m_comm;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
RtState *m_rtState;
|
||||
};
|
||||
|
||||
} // namespace AvaCommands
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetRtProfile
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLE, 2018-12-17
|
||||
*/
|
||||
|
||||
#include "set_rt_profile.h"
|
||||
#include <AudioVideoManagement/iava_command_done_observer.h>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
SetRtProfile::SetRtProfile(IAvaComm *comm, IAvaCommandDoneObserver *observer, RtState *rtState, const QVector<RtState::RadioCircuit> &radioCircuits)
|
||||
: SetRtProfileBase(comm)
|
||||
, m_radioCircuits(radioCircuits)
|
||||
, m_rtState(rtState)
|
||||
, m_observer(observer)
|
||||
{
|
||||
Q_ASSERT(observer);
|
||||
Q_ASSERT(rtState);
|
||||
}
|
||||
|
||||
void SetRtProfile::send()
|
||||
{
|
||||
connectToComm();
|
||||
|
||||
m_rtState->setRadioCircuits(m_radioCircuits);
|
||||
sendCommand(QString::fromStdString(m_rtState->toCommand()));
|
||||
}
|
||||
|
||||
void SetRtProfile::done()
|
||||
{
|
||||
disconnectFromComm();
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetRtProfile
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLE, 2018-12-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "set_rt_profile_base.h"
|
||||
#include <AudioVideoManagement/rt_state.h>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Christian Fröbel
|
||||
*/
|
||||
class SetRtProfile final : public SetRtProfileBase
|
||||
{
|
||||
public:
|
||||
SetRtProfile(IAvaComm *comm, IAvaCommandDoneObserver *observer, RtState *rtState, const QVector<RtState::RadioCircuit> &radioCircuits);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("SetRtProfile"); }
|
||||
|
||||
protected:
|
||||
void done() override;
|
||||
|
||||
private:
|
||||
const QVector<RtState::RadioCircuit> m_radioCircuits;
|
||||
RtState *m_rtState;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
};
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* @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
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetRtProfileBase
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLE, 2018-12-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AudioVideoManagement/icommand.h>
|
||||
#include <AudioVideoManagement/list_response_collector.h>
|
||||
#include <QVector>
|
||||
#include <QString>
|
||||
#include <boost/optional.hpp>
|
||||
#include <functional>
|
||||
|
||||
class QByteArray;
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* Base class for setRtProfile-related commands.
|
||||
* It implements the handling of the responses sent in return of a setRtProfile command.
|
||||
*
|
||||
* @see SetRtProfile, ChangeRtProfileCircuitName
|
||||
* @author Christian Fröbel
|
||||
*/
|
||||
class SetRtProfileBase : public ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SetRtProfileBase(IAvaComm *comm);
|
||||
|
||||
const QVector<QString> &invalidNameList() const { return *m_invalidNames; }
|
||||
|
||||
protected:
|
||||
/** Supposed to be called by the send() method of the derived class. */
|
||||
void connectToComm();
|
||||
/** Supposed to be called by the done() method of the derived class. */
|
||||
void disconnectFromComm();
|
||||
|
||||
void sendCommand(const QString &cmd);
|
||||
|
||||
virtual void done() = 0;
|
||||
|
||||
bool nullifies(ICommand *other) const override;
|
||||
|
||||
private slots:
|
||||
void onOk();
|
||||
|
||||
private:
|
||||
void onInvalidNameListReceived(QVector<QString> &&invalidNames);
|
||||
|
||||
bool m_ok{false};
|
||||
boost::optional<QVector<QString>> m_invalidNames;
|
||||
IAvaComm *m_comm;
|
||||
InvalidNameListCollector m_collector;
|
||||
};
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetScript
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Müller, SGAS, 2018-02-14
|
||||
*/
|
||||
|
||||
#include "set_script.h"
|
||||
#include "iava_comm.h"
|
||||
#include "iava_command_done_observer.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
SetScript::SetScript(IAvaComm *comm, IAvaCommandDoneObserver *doneObserver, const QString &dialogId,
|
||||
const QString &scriptName, AvaScriptSource source,
|
||||
const QVector<AvaScriptEntry> &streams)
|
||||
: m_dialogId(dialogId)
|
||||
, m_scriptName(scriptName)
|
||||
, m_scriptSource(source)
|
||||
, m_streams(streams)
|
||||
, m_comm(comm)
|
||||
, m_observer(doneObserver)
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(doneObserver);
|
||||
}
|
||||
|
||||
void SetScript::send()
|
||||
{
|
||||
connect(m_comm, &IAvaComm::scriptInfoReceived, this, &SetScript::onScriptInfoReceived);
|
||||
connect(m_comm, &IAvaComm::scriptStateReceived, this, &SetScript::onScriptStateReceived);
|
||||
|
||||
m_comm->setScript(m_dialogId, m_scriptName, m_scriptSource, m_streams);
|
||||
}
|
||||
|
||||
void SetScript::onScriptInfoReceived(const QString &dialogId, const QString &scriptName, const AvaStreamInfo &scriptInfo)
|
||||
{
|
||||
if (scriptName != m_scriptName || dialogId != m_dialogId)
|
||||
return;
|
||||
Q_ASSERT(!m_scriptInfo);
|
||||
m_scriptInfo = scriptInfo;
|
||||
|
||||
if (m_scriptState)
|
||||
done();
|
||||
}
|
||||
|
||||
void SetScript::onScriptStateReceived(const QString &dialogId, const QString &scriptName, AvaStreamState scriptState)
|
||||
{
|
||||
if (scriptName != m_scriptName || dialogId != m_dialogId)
|
||||
return;
|
||||
// Q_ASSERT(!m_scriptState);
|
||||
m_scriptState = scriptState;
|
||||
|
||||
if (m_scriptInfo)
|
||||
done();
|
||||
}
|
||||
|
||||
void SetScript::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace AudioVideoManagement::AvaCommands
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetScript
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Müller, SGAS, 2018-02-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "icommand.h"
|
||||
#include <AudioVideoManagement/ava_types.h>
|
||||
#include <QString>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* The response to setScript depends on whether a script is currently
|
||||
* set or not.
|
||||
* The response to the actual setScript contains -- among other things --
|
||||
* a ScriptInfo and a ScriptState.
|
||||
* @author Astrid Müller
|
||||
*/
|
||||
class SetScript final : public ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SetScript(IAvaComm *comm, IAvaCommandDoneObserver *doneObserver, const QString &dialogId,
|
||||
const QString &scriptName, AvaScriptSource source,
|
||||
const QVector<AvaScriptEntry> &streams);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("SetScript"); }
|
||||
|
||||
/**
|
||||
* May only be called after the command has successfully completed.
|
||||
*/
|
||||
///{@
|
||||
AvaStreamInfo scriptInfo() const { return *m_scriptInfo; }
|
||||
AvaStreamState scriptState() const { return *m_scriptState; }
|
||||
///@}
|
||||
|
||||
private slots:
|
||||
void onScriptInfoReceived(const QString &dialogId, const QString &scriptName, const AvaStreamInfo &scriptInfo);
|
||||
void onScriptStateReceived(const QString &dialogId, const QString &scriptName, AvaStreamState scriptState);
|
||||
|
||||
private:
|
||||
void done();
|
||||
|
||||
const QString m_dialogId;
|
||||
const QString m_scriptName;
|
||||
AvaScriptSource m_scriptSource;
|
||||
const QVector<AvaScriptEntry> m_streams;
|
||||
boost::optional<AvaStreamInfo> m_scriptInfo;
|
||||
boost::optional<AvaStreamState> m_scriptState;
|
||||
IAvaComm *m_comm;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace AudioVideoManagement::AvaCommands
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetVideoProfil
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Mueller, SGAS, 2017-11-30
|
||||
*/
|
||||
|
||||
#include "set_video_profile.h"
|
||||
#include "iava_comm.h"
|
||||
#include "iava_command_done_observer.h"
|
||||
#include "av_helper.h"
|
||||
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
SetVideoProfile::SetVideoProfile(IAvaComm *comm, IAvaCommandDoneObserver *observer, const QString &dialogId, const QString &menuDef)
|
||||
: m_dialogId(dialogId)
|
||||
, m_menuDef(menuDef)
|
||||
, m_comm(comm)
|
||||
, m_observer(observer)
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(observer);
|
||||
}
|
||||
|
||||
void SetVideoProfile::send()
|
||||
{
|
||||
connect(m_comm, &IAvaComm::ok, this, &SetVideoProfile::onOk);
|
||||
connect(m_comm, &IAvaComm::invalidNameListBeginReceived, this, &SetVideoProfile::onInvalidNameListBeginReceived);
|
||||
connect(m_comm, &IAvaComm::listValueReceived, this, &SetVideoProfile::onListValueReceived);
|
||||
connect(m_comm, &IAvaComm::endOfListReceived, this, &SetVideoProfile::onEndOfListReceived);
|
||||
|
||||
m_comm->setVideoProfile(m_dialogId, m_menuDef);
|
||||
}
|
||||
|
||||
void SetVideoProfile::onOk()
|
||||
{
|
||||
Q_ASSERT(!m_ok);
|
||||
Q_ASSERT(!m_withinList);
|
||||
m_ok = true;
|
||||
}
|
||||
|
||||
void SetVideoProfile::onInvalidNameListBeginReceived()
|
||||
{
|
||||
Q_ASSERT(m_ok);
|
||||
Q_ASSERT(!m_withinList);
|
||||
m_withinList = true;
|
||||
}
|
||||
|
||||
void SetVideoProfile::onListValueReceived(const QVector<QByteArray> &parts)
|
||||
{
|
||||
if (!m_withinList)
|
||||
return;
|
||||
|
||||
Q_ASSERT(parts.size() == 1);
|
||||
m_invalidNameList.push_back(QString::fromUtf8(parts.at(0)));
|
||||
}
|
||||
|
||||
void SetVideoProfile::onEndOfListReceived()
|
||||
{
|
||||
if (!m_withinList)
|
||||
return;
|
||||
|
||||
m_withinList = false;
|
||||
done();
|
||||
}
|
||||
|
||||
void SetVideoProfile::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
} // namespace AvaCommands
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetVideoProfile
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Mueller, SGAS, 2017-11-30
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "icommand.h"
|
||||
#include <AudioVideoManagement/ava_types.h>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
#include <QByteArray>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Astrid Müller
|
||||
*/
|
||||
class SetVideoProfile final : public ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SetVideoProfile(IAvaComm *comm, IAvaCommandDoneObserver *observer, const QString &dialogId, const QString &menuDef);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("SetVideoProfile"); }
|
||||
|
||||
const QVector<QString> &invalidNameList() const { return m_invalidNameList; }
|
||||
|
||||
private slots:
|
||||
void onOk();
|
||||
void onInvalidNameListBeginReceived();
|
||||
void onListValueReceived(const QVector<QByteArray> &parts);
|
||||
void onEndOfListReceived();
|
||||
|
||||
private:
|
||||
void done();
|
||||
|
||||
const QString m_dialogId;
|
||||
const QString m_menuDef;
|
||||
bool m_ok{false};
|
||||
bool m_withinList{false};
|
||||
QVector<QString> m_invalidNameList;
|
||||
IAvaComm *m_comm;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
};
|
||||
|
||||
} // namespace AvaCommands
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetVolume
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLSE, 2018-02-28
|
||||
*/
|
||||
|
||||
#include "set_volume.h"
|
||||
#include "iava_comm.h"
|
||||
#include "iava_command_done_observer.h"
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
SetVolume::SetVolume(IAvaComm *comm, IAvaCommandDoneObserver *doneObserver, AvaVolume db)
|
||||
: m_db(db)
|
||||
, m_comm(comm)
|
||||
, m_observer(doneObserver)
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(doneObserver);
|
||||
}
|
||||
|
||||
void SetVolume::send()
|
||||
{
|
||||
QObject::connect(m_comm, &IAvaComm::ok, this, &SetVolume::onOk);
|
||||
QObject::connect(m_comm, &IAvaComm::volumeReceived, this, &SetVolume::onVolumeReceived);
|
||||
|
||||
m_comm->setVolume(m_db);
|
||||
}
|
||||
|
||||
bool SetVolume::nullifies(ICommand *other) const
|
||||
{
|
||||
Q_ASSERT(other);
|
||||
SetVolume *other_ = dynamic_cast<SetVolume*>(other);
|
||||
if (!other_)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetVolume::onOk()
|
||||
{
|
||||
Q_ASSERT(!m_ok);
|
||||
m_ok = true;
|
||||
}
|
||||
|
||||
void SetVolume::onVolumeReceived(AvaVolume db)
|
||||
{
|
||||
Q_UNUSED(db);
|
||||
|
||||
if (!m_ok)
|
||||
return;
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
void SetVolume::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SetVolume
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, NLSE, 2018-02-28
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AudioVideoManagement/icommand.h>
|
||||
#include <AudioVideoManagement/ava_types.h>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Christian Fröbel
|
||||
*/
|
||||
class SetVolume final : public ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SetVolume(IAvaComm *comm, IAvaCommandDoneObserver *doneObserver, AvaVolume db);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("SetVolume"); }
|
||||
|
||||
bool nullifies(ICommand *other) const override;
|
||||
|
||||
private slots:
|
||||
void onOk();
|
||||
void onVolumeReceived(AvaVolume db);
|
||||
|
||||
private:
|
||||
void done();
|
||||
|
||||
AvaVolume m_db;
|
||||
bool m_ok{false};
|
||||
IAvaComm *m_comm;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
};
|
||||
|
||||
}} // namespace AudioVideoManagement::AvaCommands
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SimpleCommand
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, SLSE, 2017-07-11
|
||||
*/
|
||||
|
||||
#include "simple_command.h"
|
||||
#include "iava_comm.h"
|
||||
#include "iava_command_done_observer.h"
|
||||
#include "ivd_comm.h"
|
||||
#include "ivd_command_done_observer.h"
|
||||
#include <QtGlobal>
|
||||
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<class Comm, class DoneObserver>
|
||||
SimpleCommand<Comm, DoneObserver>::SimpleCommand(const QString &commandDesc, Comm *comm, DoneObserver *observer, std::function<void (Comm *)> commandInvoker, int okCount)
|
||||
: m_commandInvoker(std::move(commandInvoker))
|
||||
, m_expectedOkCount(okCount)
|
||||
, m_comm(comm)
|
||||
, m_observer(observer)
|
||||
, m_commandDesc(commandDesc)
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(observer);
|
||||
Q_ASSERT(okCount > 0);
|
||||
}
|
||||
|
||||
template<class Comm, class DoneObserver>
|
||||
void SimpleCommand<Comm, DoneObserver>::send()
|
||||
{
|
||||
connect(m_comm, &Comm::ok, this, &SimpleCommand::onOk);
|
||||
m_commandInvoker(m_comm);
|
||||
}
|
||||
|
||||
template<class Comm, class DoneObserver>
|
||||
void SimpleCommand<Comm, DoneObserver>::onOk()
|
||||
{
|
||||
Q_ASSERT(m_okCount < m_expectedOkCount);
|
||||
++m_okCount;
|
||||
if (m_okCount == m_expectedOkCount)
|
||||
done();
|
||||
}
|
||||
|
||||
template<class Comm, class DoneObserver>
|
||||
void SimpleCommand<Comm, DoneObserver>::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Explicit template instantiations.
|
||||
*/
|
||||
///@{
|
||||
template class SimpleCommand<IAvaComm, IAvaCommandDoneObserver>;
|
||||
template class SimpleCommand<IVdComm, IVdCommandDoneObserver>;
|
||||
///@}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* SimpleCommand
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Fröbel, SLSE, 2017-07-11
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "icommand.h"
|
||||
#include <functional>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
class IVdComm;
|
||||
class IVdCommandDoneObserver;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
/**
|
||||
* A SimpleCommand synchronises only with the OK response sent by the AVS.
|
||||
* In order to invoke the actual command, a function object needs to be supplied
|
||||
* which then calls the corresponding method on AvaComm or VdComm.
|
||||
*
|
||||
* @author Christian Fröbel
|
||||
*/
|
||||
template<class Comm, class DoneObserver>
|
||||
class SimpleCommand : public ICommand
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* The AVS responds to some commands with more than one OK. In that case
|
||||
* the number of expected OK-responses can be specified.
|
||||
*/
|
||||
SimpleCommand(const QString &commandDesc, Comm *comm, DoneObserver *observer, std::function<void (Comm *)> commandInvoker, int okCount = 1);
|
||||
QString debug() const override { return m_commandDesc; }
|
||||
|
||||
void send() override;
|
||||
|
||||
private slots:
|
||||
void onOk();
|
||||
|
||||
private:
|
||||
void done();
|
||||
|
||||
std::function<void (Comm *)> m_commandInvoker;
|
||||
const int m_expectedOkCount;
|
||||
int m_okCount{0};
|
||||
Comm *m_comm;
|
||||
DoneObserver *m_observer;
|
||||
QString m_commandDesc;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
using SimpleCommand = detail::SimpleCommand<IAvaComm, IAvaCommandDoneObserver>;
|
||||
}
|
||||
|
||||
|
||||
namespace VdCommands
|
||||
{
|
||||
using SimpleCommand = detail::SimpleCommand<IVdComm, IVdCommandDoneObserver>;
|
||||
}
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* StartScript
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Müller, SGAS, 2018-02-14
|
||||
*/
|
||||
|
||||
#include "start_script.h"
|
||||
#include "iava_comm.h"
|
||||
#include "iava_command_done_observer.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
StartScript::StartScript(IAvaComm *comm, IAvaCommandDoneObserver *doneObserver, const QString &dialogId, const QString &scriptName, bool bBlocking)
|
||||
: m_dialogId(dialogId)
|
||||
, m_scriptName(scriptName)
|
||||
, m_comm(comm)
|
||||
, m_observer(doneObserver)
|
||||
, m_bBlocking(bBlocking)
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(doneObserver);
|
||||
}
|
||||
|
||||
void StartScript::send()
|
||||
{
|
||||
connect(m_comm, &IAvaComm::scriptStateReceived, this, &StartScript::onScriptStateReceived);
|
||||
connect(m_comm, &IAvaComm::scriptPositionReceived, this, &StartScript::onScriptPositionReceived);
|
||||
|
||||
m_comm->startScript(m_dialogId, m_scriptName);
|
||||
|
||||
if (!m_bBlocking)
|
||||
done();
|
||||
}
|
||||
|
||||
void StartScript::onScriptStateReceived(const QString &dialogId, const QString &scriptName, AvaStreamState scriptState)
|
||||
{
|
||||
Q_ASSERT(dialogId == m_dialogId);
|
||||
Q_ASSERT(scriptName == m_scriptName);
|
||||
m_scriptState = scriptState;
|
||||
|
||||
if (m_scriptState == AvaStreamState::Stop || m_scriptState == AvaStreamState::NotPossible)
|
||||
done();
|
||||
}
|
||||
|
||||
void StartScript::onScriptPositionReceived(const QString &dialogId, const QString &scriptName, const QString &streamName, AvaTimePoint pos, AvaTimePoint relPos)
|
||||
{
|
||||
if (scriptName != m_scriptName || dialogId != m_dialogId)
|
||||
return;
|
||||
Q_UNUSED(streamName);
|
||||
Q_UNUSED(pos);
|
||||
Q_UNUSED(relPos);
|
||||
|
||||
m_observer->alive(this);
|
||||
}
|
||||
|
||||
void StartScript::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace AudioVideoManagement::AvaCommands
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* StartScript
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Müller, SGAS, 2018-02-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "icommand.h"
|
||||
#include <AudioVideoManagement/ava_types.h>
|
||||
#include <QString>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IAvaComm;
|
||||
class IAvaCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* The response to StartScript depends on whether a script is started
|
||||
* or not.
|
||||
* The response to the actual StartScript contains
|
||||
* a ScriptState.
|
||||
* @author Hanna E. Rathje
|
||||
*/
|
||||
class StartScript final : public ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StartScript(IAvaComm *comm, IAvaCommandDoneObserver *doneObserver, const QString &dialogId, const QString &scriptName, bool bBlocking);
|
||||
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("StartScript"); }
|
||||
|
||||
/**
|
||||
* May only be called after the command has successfully completed.
|
||||
*/
|
||||
///{@
|
||||
AvaStreamState scriptState() const { return *m_scriptState; }
|
||||
///@}
|
||||
|
||||
private slots:
|
||||
void onScriptStateReceived(const QString &dialogId, const QString &scriptName, AvaStreamState scriptState);
|
||||
void onScriptPositionReceived(const QString &dialogId, const QString &scriptName, const QString &streamName, AvaTimePoint pos, AvaTimePoint relPos);
|
||||
|
||||
private:
|
||||
void done();
|
||||
|
||||
const QString m_dialogId;
|
||||
const QString m_scriptName;
|
||||
boost::optional<AvaStreamState> m_scriptState;
|
||||
IAvaComm *m_comm;
|
||||
IAvaCommandDoneObserver *m_observer;
|
||||
bool m_bBlocking;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace AudioVideoManagement::AvaCommands
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* VdSetScript
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Müller, SGAS, 2018-06-18
|
||||
*/
|
||||
|
||||
#include "vd_set_script.h"
|
||||
#include "ivd_comm.h"
|
||||
#include "ivd_command_done_observer.h"
|
||||
#include "logger.h"
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
VdSetScript::VdSetScript(IVdComm *comm, IVdCommandDoneObserver *doneObserver, const QString &scriptName, AvaStreamType typ, int fileSplitting,
|
||||
const QVector<AvaScriptEntry> &streams, const QString &exportedDirBaseName, const QString &absolutePath)
|
||||
: m_scriptName(scriptName)
|
||||
, m_type(typ)
|
||||
, m_state(AvaStreamState::NotPossible)
|
||||
, m_fileSplitting(fileSplitting)
|
||||
, m_streams(streams)
|
||||
, m_exportedDirBaseName(exportedDirBaseName)
|
||||
, m_absolutePath(absolutePath)
|
||||
, m_comm(comm)
|
||||
, m_observer(doneObserver)
|
||||
{
|
||||
Q_ASSERT(comm);
|
||||
Q_ASSERT(doneObserver);
|
||||
}
|
||||
|
||||
void VdSetScript::send()
|
||||
{
|
||||
connect(m_comm, &IVdComm::scriptExportProgress, this, &VdSetScript::onScriptExportProgress);
|
||||
connect(m_comm, &IVdComm::scriptStateReceived, this, &VdSetScript::onScriptStateReceived);
|
||||
|
||||
m_comm->vdSetScript(m_scriptName, m_type, m_fileSplitting, m_streams, m_exportedDirBaseName, m_absolutePath);
|
||||
}
|
||||
|
||||
void VdSetScript::onScriptExportProgress(int progress)
|
||||
{
|
||||
Q_UNUSED(progress);
|
||||
m_observer->alive(this);
|
||||
}
|
||||
|
||||
void VdSetScript::onScriptStateReceived(const QString &scriptName, AvaStreamState state)
|
||||
{
|
||||
if (m_scriptName != scriptName)
|
||||
return;
|
||||
DEBUG_LOG(getLogger("ExportScript")) << "onScriptStateReceived: " << m_scriptName << ", " << int(m_state) << " -> " << int(state);
|
||||
if (m_state == AvaStreamState::Start && state == AvaStreamState::Stop)
|
||||
done();
|
||||
if (state == AvaStreamState::NotPossible)
|
||||
done();
|
||||
m_state = state;
|
||||
}
|
||||
|
||||
void VdSetScript::done()
|
||||
{
|
||||
m_comm->disconnect(this);
|
||||
m_observer->done(this);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace AudioVideoManagement::AvaCommands
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* VdSetScript
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Müller, SGAS, 2018-06-18
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "icommand.h"
|
||||
#include <AudioVideoManagement/ava_types.h>
|
||||
#include <QString>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class IVdComm;
|
||||
class IVdCommandDoneObserver;
|
||||
|
||||
namespace AvaCommands
|
||||
{
|
||||
|
||||
/**
|
||||
* The response to VdSetScript depends on whether a script is currently
|
||||
* set or not.
|
||||
* The response to the actual VdSetScript contains -- among other things --
|
||||
* a ScriptInfo and a ScriptState and a ScriptPos.
|
||||
* The export is completed when the ExportProgress is 100%.
|
||||
* @author Astrid Müller
|
||||
*/
|
||||
class VdSetScript : public ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
VdSetScript(IVdComm *comm, IVdCommandDoneObserver *doneObserver, const QString &scriptName, AvaStreamType typ, int fileSplitting,
|
||||
const QVector<AvaScriptEntry> &streams, const QString &exportedDirBaseName, const QString &absolutePath);
|
||||
void send() override;
|
||||
QString debug() const override { return QLatin1String("VdSetScript"); }
|
||||
|
||||
const QString getAvDir() { return (m_absolutePath + QLatin1Char('/') + m_exportedDirBaseName); }
|
||||
AvaStreamType getStreamType() { return m_type; }
|
||||
bool wasSuccessful() { return m_state != AvaStreamState::NotPossible; }
|
||||
|
||||
private slots:
|
||||
void onScriptExportProgress(int progress);
|
||||
void onScriptStateReceived(const QString &scriptName, AvaStreamState state);
|
||||
|
||||
private:
|
||||
void done();
|
||||
|
||||
const QString m_scriptName;
|
||||
AvaStreamType m_type;
|
||||
AvaStreamState m_state;
|
||||
int m_fileSplitting;
|
||||
const QVector<AvaScriptEntry> m_streams;
|
||||
const QString m_exportedDirBaseName;
|
||||
const QString m_absolutePath;
|
||||
IVdComm *m_comm;
|
||||
IVdCommandDoneObserver *m_observer;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace AudioVideoManagement::AvaCommands
|
||||
|
||||
Reference in new issue
Block a user