Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user