|
|
|
@@ -41,7 +41,7 @@ bool HandlerSounds::init()
|
|
|
|
|
SoundManagement::Sounds topicData;
|
|
|
|
|
SoundManagement::Sound sound;
|
|
|
|
|
|
|
|
|
|
INFO_LOG() << "HandlerConfigureSounds::init";
|
|
|
|
|
INFO_LOG(m_logger) << "HandlerConfigureSounds::init";
|
|
|
|
|
|
|
|
|
|
auto dtcIsm = m_ddsHandler->dtcIsm();
|
|
|
|
|
auto dtcSom = m_ddsHandler->dtcSom();
|
|
|
|
@@ -59,14 +59,14 @@ bool HandlerSounds::init()
|
|
|
|
|
QVector<Database::SomSound> soundVec;
|
|
|
|
|
if (!m_dbHandler->db()->select(soundVec))
|
|
|
|
|
{
|
|
|
|
|
ERROR_LOG() << "Error reading data from database 'som_sound'!";
|
|
|
|
|
ERROR_LOG(m_logger) << "Error reading data from database 'som_sound'!";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const Database::SomSound &data : std::as_const(soundVec))
|
|
|
|
|
{
|
|
|
|
|
static int index = 0;
|
|
|
|
|
DEBUG_LOG() << "SomSound from DB data: id=" << data.id
|
|
|
|
|
DEBUG_LOG(m_logger) << "SomSound from DB data: id=" << data.id
|
|
|
|
|
<< " categoryId=" << data.categoryId
|
|
|
|
|
<< " name=" << data.name
|
|
|
|
|
<< " displayName=" << data.displayName;
|
|
|
|
@@ -80,7 +80,7 @@ bool HandlerSounds::init()
|
|
|
|
|
soundEntry.duration = data.duration;
|
|
|
|
|
soundEntry.isRepeatable = data.isRepeatable;
|
|
|
|
|
m_soundNames.append(soundEntry);
|
|
|
|
|
DEBUG_LOG() << "id=" << index
|
|
|
|
|
DEBUG_LOG(m_logger) << "id=" << index
|
|
|
|
|
<< " SomSound from DB data: id=" << soundEntry.index
|
|
|
|
|
<< " categoryId=" << soundEntry.category
|
|
|
|
|
<< " name=" << soundEntry.name
|
|
|
|
@@ -116,10 +116,10 @@ bool HandlerSounds::init()
|
|
|
|
|
|
|
|
|
|
void HandlerSounds::getActiveSounds()
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "getActiveSounds";
|
|
|
|
|
DEBUG_LOG(m_logger) << "getActiveSounds";
|
|
|
|
|
if (m_hostnames.size() == 0)
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "No EGCUs available send empty topic ActiveSounds";
|
|
|
|
|
DEBUG_LOG(m_logger) << "No EGCUs available send empty topic ActiveSounds";
|
|
|
|
|
m_updateActiveSoundsTimer->stop();
|
|
|
|
|
// TODO alle aktiven Sounds vom DDS-Bus loeschen
|
|
|
|
|
return;
|
|
|
|
@@ -133,7 +133,7 @@ void HandlerSounds::getActiveSounds()
|
|
|
|
|
{
|
|
|
|
|
i.next();
|
|
|
|
|
QString hostname = i.value();
|
|
|
|
|
DEBUG_LOG() << "getActiveSound hostname=" << hostname;
|
|
|
|
|
DEBUG_LOG(m_logger) << "getActiveSound hostname=" << hostname;
|
|
|
|
|
getActiveSound(getAssetId(hostname));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -144,7 +144,7 @@ void HandlerSounds::onGetActiveSoundsRequest(const rti::core::SampleIdentity &co
|
|
|
|
|
{
|
|
|
|
|
// 200{ "ID":"0x510","Name":"Sound Report","sounds":[{"category":"Explosions","sound":"0001"}]}
|
|
|
|
|
Core::FunctionReplyObject reply = Core::FunctionReplyObject(0, tr_lts("dds", "GetActiveSounds "));
|
|
|
|
|
DEBUG_LOG() << "onGetActiveSoundsRequest: " << request;
|
|
|
|
|
DEBUG_LOG(m_logger) << "onGetActiveSoundsRequest: " << request;
|
|
|
|
|
m_ddsHandler->ftsSom()->getActiveSoundsReply(cookie, reply);
|
|
|
|
|
// Request each EGCU
|
|
|
|
|
// Wait for response from each EGCU
|
|
|
|
@@ -156,7 +156,7 @@ void HandlerSounds::onGetActiveSoundsRequest(const rti::core::SampleIdentity &co
|
|
|
|
|
void HandlerSounds::onStopAllSoundsRequest(const rti::core::SampleIdentity &cookie,
|
|
|
|
|
const StopAllSoundsRequest &request)
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "StopAllSounds: " << request;
|
|
|
|
|
DEBUG_LOG(m_logger) << "StopAllSounds: " << request;
|
|
|
|
|
int failedCount = 0;
|
|
|
|
|
|
|
|
|
|
if (request.egcuId() == -1) // stopp all sounds on each EGCU
|
|
|
|
@@ -167,7 +167,7 @@ void HandlerSounds::onStopAllSoundsRequest(const rti::core::SampleIdentity &cook
|
|
|
|
|
{
|
|
|
|
|
i.next();
|
|
|
|
|
const QString hostname = m_hostnames.value(i.key());
|
|
|
|
|
DEBUG_LOG() << "hostname=" << hostname;
|
|
|
|
|
DEBUG_LOG(m_logger) << "hostname=" << hostname;
|
|
|
|
|
if (!stopAllSounds(i.key()).isEmpty()) // BLOCKING
|
|
|
|
|
failedCount++;
|
|
|
|
|
}
|
|
|
|
@@ -176,7 +176,7 @@ void HandlerSounds::onStopAllSoundsRequest(const rti::core::SampleIdentity &cook
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
QString hostname = m_hostnames.value(request.egcuId());
|
|
|
|
|
DEBUG_LOG() << "getActiveSound hostname=" << hostname;
|
|
|
|
|
DEBUG_LOG(m_logger) << "getActiveSound hostname=" << hostname;
|
|
|
|
|
if (!stopAllSounds(request.egcuId()).isEmpty()) // BLOCKING
|
|
|
|
|
failedCount++;
|
|
|
|
|
}
|
|
|
|
@@ -192,7 +192,7 @@ void HandlerSounds::onGetSoundsRequest(const rti::core::SampleIdentity &cookie,
|
|
|
|
|
const GetSoundsRequest &request)
|
|
|
|
|
{
|
|
|
|
|
Core::FunctionReplyObject reply = Core::FunctionReplyObject(0, tr_lts("dds", "GetSounds"));
|
|
|
|
|
DEBUG_LOG() << "GetSounds: " << request;
|
|
|
|
|
DEBUG_LOG(m_logger) << "GetSounds: " << request;
|
|
|
|
|
m_ddsHandler->ftsSom()->getSoundsReply(cookie, reply);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -251,10 +251,10 @@ SoundManagement::SoundCategory HandlerSounds::stringToEnum(const QString &catego
|
|
|
|
|
* void HandlerMenuStruct::onModifyMenuStructRequest(const rti::core::SampleIdentity &cookie,
|
|
|
|
|
const MenuStruct &request)
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "onModifyMenuStructRequest: " << request;
|
|
|
|
|
DEBUG_LOG(m_logger) << "onModifyMenuStructRequest: " << request;
|
|
|
|
|
auto ret = request.id() > 0 ? modifyMenuStructRequest(request) : createMenuStructRequest(request);
|
|
|
|
|
if (ret.error())
|
|
|
|
|
WARNING_LOG() << ret();
|
|
|
|
|
WARNING_LOG(m_logger) << ret();
|
|
|
|
|
m_fts->modifyMenuStructReply(cookie, ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -262,7 +262,7 @@ Core::FunctionReplyObject HandlerMenuStruct::createMenuStructRequest(const MenuS
|
|
|
|
|
{
|
|
|
|
|
ObjectMenuStruct *ifs = new ObjectMenuStruct(m_dts, m_db);
|
|
|
|
|
|
|
|
|
|
DEBUG_LOG() << "request.menuEntries.size() : " << request.menuEntries().size();
|
|
|
|
|
DEBUG_LOG(m_logger) << "request.menuEntries.size() : " << request.menuEntries().size();
|
|
|
|
|
Core::FunctionReplyObject ret = ifs->createFromDds(request);
|
|
|
|
|
|
|
|
|
|
if (ret.error())
|
|
|
|
@@ -279,7 +279,7 @@ Core::FunctionReplyObject HandlerMenuStruct::createMenuStructRequest(const MenuS
|
|
|
|
|
void HandlerSounds::onControlSoundRequest(const rti::core::SampleIdentity &cookie,
|
|
|
|
|
const ControlSoundRequest &request)
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "ControlSound: " << request
|
|
|
|
|
DEBUG_LOG(m_logger) << "ControlSound: " << request
|
|
|
|
|
<< " category=" << request.category();
|
|
|
|
|
|
|
|
|
|
const QString user = Settings::somUser();
|
|
|
|
@@ -304,7 +304,7 @@ void HandlerSounds::onControlSoundRequest(const rti::core::SampleIdentity &cooki
|
|
|
|
|
const int soundId = request.soundId();
|
|
|
|
|
const int egcuId = request.egcuId();
|
|
|
|
|
const SoundManagement::SoundCategory category = request.category();
|
|
|
|
|
DEBUG_LOG() << "Play: durationMs=" << durationMs
|
|
|
|
|
DEBUG_LOG(m_logger) << "Play: durationMs=" << durationMs
|
|
|
|
|
<< " egcuId=" << egcuId
|
|
|
|
|
<< " soundId=" << soundId
|
|
|
|
|
<< " loop=" << loop;
|
|
|
|
@@ -332,7 +332,7 @@ void HandlerSounds::onControlSoundRequest(const rti::core::SampleIdentity &cooki
|
|
|
|
|
soundState.id(m_indexActiveSound);
|
|
|
|
|
soundState.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
|
|
|
|
soundState.inLoop(loop);
|
|
|
|
|
DEBUG_LOG() << "id=" << m_indexActiveSound
|
|
|
|
|
DEBUG_LOG(m_logger) << "id=" << m_indexActiveSound
|
|
|
|
|
<< " category=" << request.category()
|
|
|
|
|
<< " egcuId=" << request.egcuId()
|
|
|
|
|
<< " soundId=" << request.soundId()
|
|
|
|
@@ -370,7 +370,7 @@ void HandlerSounds::onStopSingleSound(const int egcuId, const SoundManagement::
|
|
|
|
|
QString passwd = Settings::somPasswd();
|
|
|
|
|
QString host = m_hostnames.value(egcuId);
|
|
|
|
|
|
|
|
|
|
DEBUG_LOG() << "egcuId=" << egcuId
|
|
|
|
|
DEBUG_LOG(m_logger) << "egcuId=" << egcuId
|
|
|
|
|
<< " soundId=" << soundId
|
|
|
|
|
<< " category=" << enumToString(soundCategory);
|
|
|
|
|
|
|
|
|
@@ -381,7 +381,7 @@ void HandlerSounds::onStopSingleSound(const int egcuId, const SoundManagement::
|
|
|
|
|
const SoundState &item = it.next();
|
|
|
|
|
if ((item.soundId() == soundId) && (item.egcuId() == egcuId) && item.category() == soundCategory)
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "remove Sound from DDS-BUS id=" << item.id()
|
|
|
|
|
DEBUG_LOG(m_logger) << "remove Sound from DDS-BUS id=" << item.id()
|
|
|
|
|
<< " egcuId=" << item.egcuId();
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
@@ -439,11 +439,11 @@ QString HandlerSounds::stopAllSounds(const int egcuId)
|
|
|
|
|
{
|
|
|
|
|
const SoundState &ss(it.next());
|
|
|
|
|
|
|
|
|
|
DEBUG_LOG() << "Sound EGCU=" << ss.egcuId() << " soundId=" << ss.soundId();
|
|
|
|
|
DEBUG_LOG(m_logger) << "Sound EGCU=" << ss.egcuId() << " soundId=" << ss.soundId();
|
|
|
|
|
if (ss.egcuId() != egcuId)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
DEBUG_LOG() << "remove Sound from DDS-BUS id=" << ss.id()
|
|
|
|
|
DEBUG_LOG(m_logger) << "remove Sound from DDS-BUS id=" << ss.id()
|
|
|
|
|
<< " egcuId=" << ss.egcuId();
|
|
|
|
|
m_ddsHandler->dtsSom()->removeSoundStateByKey(ss.id());
|
|
|
|
|
it.remove();
|
|
|
|
@@ -469,7 +469,7 @@ void HandlerSounds::getActiveSound(const int egcuId)
|
|
|
|
|
url.setUrl(request);
|
|
|
|
|
url.setUserName(user);
|
|
|
|
|
url.setPassword(passwd);
|
|
|
|
|
DEBUG_LOG() << "startRequest: " << url.toString();
|
|
|
|
|
DEBUG_LOG(m_logger) << "startRequest: " << url.toString();
|
|
|
|
|
startRequest(url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -492,14 +492,14 @@ QString HandlerSounds::playBackgroundSound(const QString &user,
|
|
|
|
|
url.setUrl(request);
|
|
|
|
|
url.setUserName(user);
|
|
|
|
|
url.setPassword(passwd);
|
|
|
|
|
DEBUG_LOG() << "startRequest: " << url.toString()
|
|
|
|
|
DEBUG_LOG(m_logger) << "startRequest: " << url.toString()
|
|
|
|
|
<< " host=" << host;
|
|
|
|
|
return startRequestBlocking(url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString HandlerSounds::startRequestBlocking(const QUrl &requestedUrl)
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "startRequest: " << requestedUrl.toString();
|
|
|
|
|
DEBUG_LOG(m_logger) << "startRequest: " << requestedUrl.toString();
|
|
|
|
|
m_httpRequestAborted = false;
|
|
|
|
|
auto reply = m_qnam.get(QNetworkRequest(requestedUrl));
|
|
|
|
|
await(reply, &QNetworkReply::finished);
|
|
|
|
@@ -508,7 +508,7 @@ QString HandlerSounds::startRequestBlocking(const QUrl &requestedUrl)
|
|
|
|
|
|
|
|
|
|
void HandlerSounds::startRequest(const QUrl &requestedUrl)
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "startRequest: " << requestedUrl.toString();
|
|
|
|
|
DEBUG_LOG(m_logger) << "startRequest: " << requestedUrl.toString();
|
|
|
|
|
m_httpRequestAborted = false;
|
|
|
|
|
auto reply = m_qnam.get(QNetworkRequest(requestedUrl));
|
|
|
|
|
connect(reply, &QNetworkReply::finished, this, &HandlerSounds::httpFinished);
|
|
|
|
@@ -516,7 +516,7 @@ void HandlerSounds::startRequest(const QUrl &requestedUrl)
|
|
|
|
|
|
|
|
|
|
QString HandlerSounds::httpFinishedBlocking(QNetworkReply *reply)
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "httpFinishedBlocking";
|
|
|
|
|
DEBUG_LOG(m_logger) << "httpFinishedBlocking";
|
|
|
|
|
QUrl url;
|
|
|
|
|
// auto reply = qobject_cast<QNetworkReply *>(sender());
|
|
|
|
|
// Q_ASSERT(reply);
|
|
|
|
@@ -527,7 +527,7 @@ QString HandlerSounds::httpFinishedBlocking(QNetworkReply *reply)
|
|
|
|
|
|
|
|
|
|
if (m_httpRequestAborted)
|
|
|
|
|
{
|
|
|
|
|
ERROR_LOG() << "httpRequestAborted";
|
|
|
|
|
ERROR_LOG(m_logger) << "httpRequestAborted";
|
|
|
|
|
reply->deleteLater();
|
|
|
|
|
return QString::fromStdString(tr_lts("dds", "httpRequestAborted"));
|
|
|
|
|
}
|
|
|
|
@@ -536,7 +536,7 @@ QString HandlerSounds::httpFinishedBlocking(QNetworkReply *reply)
|
|
|
|
|
{
|
|
|
|
|
QByteArray data = reply->readAll();
|
|
|
|
|
QString dataStr = QString::fromStdString(data.toStdString());
|
|
|
|
|
ERROR_LOG() << "reply->error: " << reply->errorString()
|
|
|
|
|
ERROR_LOG(m_logger) << "reply->error: " << reply->errorString()
|
|
|
|
|
<< " host=" << url.host()
|
|
|
|
|
<< " query='" << url.query()
|
|
|
|
|
<< "' '" << qUtf8Printable(url.toString()) << "'"
|
|
|
|
@@ -545,7 +545,7 @@ QString HandlerSounds::httpFinishedBlocking(QNetworkReply *reply)
|
|
|
|
|
QString query = url.query();
|
|
|
|
|
if (query.contains(QStringLiteral("control=5")))
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "m_activeSounds.insert host=" << url.host();
|
|
|
|
|
DEBUG_LOG(m_logger) << "m_activeSounds.insert host=" << url.host();
|
|
|
|
|
m_activeSounds.insert(url.host(), QString());
|
|
|
|
|
}
|
|
|
|
|
reply->deleteLater();
|
|
|
|
@@ -557,7 +557,7 @@ QString HandlerSounds::httpFinishedBlocking(QNetworkReply *reply)
|
|
|
|
|
|
|
|
|
|
//parse the reply JSON and display result in the UI
|
|
|
|
|
const QByteArray json(reply->readAll());
|
|
|
|
|
DEBUG_LOG() << "Sucess " << json;
|
|
|
|
|
DEBUG_LOG(m_logger) << "Sucess " << json;
|
|
|
|
|
QString jsonStr = QString::fromStdString(json.toStdString());
|
|
|
|
|
if (jsonStr.contains(QStringLiteral("510"))) // 510 = Sound Report
|
|
|
|
|
handleSoundReport(jsonStr, url.host());
|
|
|
|
@@ -568,7 +568,7 @@ QString HandlerSounds::httpFinishedBlocking(QNetworkReply *reply)
|
|
|
|
|
|
|
|
|
|
void HandlerSounds::httpFinished()
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "httpFinished";
|
|
|
|
|
DEBUG_LOG(m_logger) << "httpFinished";
|
|
|
|
|
QUrl url;
|
|
|
|
|
auto reply = qobject_cast<QNetworkReply *>(sender());
|
|
|
|
|
if (!reply)
|
|
|
|
@@ -578,7 +578,7 @@ void HandlerSounds::httpFinished()
|
|
|
|
|
|
|
|
|
|
if (m_httpRequestAborted)
|
|
|
|
|
{
|
|
|
|
|
ERROR_LOG() << "httpRequestAborted";
|
|
|
|
|
ERROR_LOG(m_logger) << "httpRequestAborted";
|
|
|
|
|
reply->deleteLater();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@@ -587,7 +587,7 @@ void HandlerSounds::httpFinished()
|
|
|
|
|
{
|
|
|
|
|
QByteArray data = reply->readAll();
|
|
|
|
|
QString dataStr = QString::fromStdString(data.toStdString());
|
|
|
|
|
ERROR_LOG() << "reply->error: " << reply->errorString()
|
|
|
|
|
ERROR_LOG(m_logger) << "reply->error: " << reply->errorString()
|
|
|
|
|
<< " host=" << url.host()
|
|
|
|
|
<< " query='" << url.query()
|
|
|
|
|
<< "' '" << qUtf8Printable(url.toString()) << "'"
|
|
|
|
@@ -596,7 +596,7 @@ void HandlerSounds::httpFinished()
|
|
|
|
|
QString query = url.query();
|
|
|
|
|
if (query.contains(QStringLiteral("control=5")))
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "m_activeSounds.insert host=" << url.host();
|
|
|
|
|
DEBUG_LOG(m_logger) << "m_activeSounds.insert host=" << url.host();
|
|
|
|
|
m_activeSounds.insert(url.host(), QString());
|
|
|
|
|
}
|
|
|
|
|
reply->deleteLater();
|
|
|
|
@@ -608,7 +608,7 @@ void HandlerSounds::httpFinished()
|
|
|
|
|
|
|
|
|
|
//parse the reply JSON and display result in the UI
|
|
|
|
|
const QByteArray json(reply->readAll());
|
|
|
|
|
DEBUG_LOG() << "Sucess " << json;
|
|
|
|
|
DEBUG_LOG(m_logger) << "Sucess " << json;
|
|
|
|
|
QString jsonStr = QString::fromStdString(json.toStdString());
|
|
|
|
|
if (jsonStr.contains(QStringLiteral("510"))) // 510 = Sound Report
|
|
|
|
|
handleSoundReport(jsonStr, url.host());
|
|
|
|
@@ -645,7 +645,7 @@ int HandlerSounds::getDuration(const SoundManagement::SoundCategory& category,co
|
|
|
|
|
if ( soundId == soundName.soundId
|
|
|
|
|
&& category == soundName.category)
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "Duration=" << soundName.duration << "ms";
|
|
|
|
|
DEBUG_LOG(m_logger) << "Duration=" << soundName.duration << "ms";
|
|
|
|
|
return soundName.duration;
|
|
|
|
|
}
|
|
|
|
|
} // for
|
|
|
|
@@ -657,15 +657,15 @@ void HandlerSounds::handleSoundReport(const QString &json, const QString &host)
|
|
|
|
|
SoundManagement::SoundState soundState;
|
|
|
|
|
QString jsonString;
|
|
|
|
|
QString jsonStr = QString::fromStdString(json.toStdString());
|
|
|
|
|
DEBUG_LOG() << "remove 200";
|
|
|
|
|
DEBUG_LOG(m_logger) << "remove 200";
|
|
|
|
|
jsonString = jsonStr.remove(QStringLiteral("200"));
|
|
|
|
|
m_activeSounds.insert(host, jsonString);
|
|
|
|
|
// Send Result Topic
|
|
|
|
|
DEBUG_LOG() << "Send Result Topic";
|
|
|
|
|
DEBUG_LOG(m_logger) << "Send Result Topic";
|
|
|
|
|
|
|
|
|
|
DEBUG_LOG() << "m_updateActiveSoundsTimer->stop();";
|
|
|
|
|
DEBUG_LOG(m_logger) << "m_updateActiveSoundsTimer->stop();";
|
|
|
|
|
|
|
|
|
|
DEBUG_LOG() << "host=" << host
|
|
|
|
|
DEBUG_LOG(m_logger) << "host=" << host
|
|
|
|
|
<< " jsonString= " << jsonString;
|
|
|
|
|
// decode JSON-Object
|
|
|
|
|
QJsonDocument doc = QJsonDocument::fromJson(jsonString.toUtf8());
|
|
|
|
@@ -698,7 +698,7 @@ void HandlerSounds::handleSoundReport(const QString &json, const QString &host)
|
|
|
|
|
soundState.category(category);
|
|
|
|
|
soundState.id(m_indexActiveSound);
|
|
|
|
|
soundState.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
|
|
|
|
DEBUG_LOG() << "id=" << m_indexActiveSound
|
|
|
|
|
DEBUG_LOG(m_logger) << "id=" << m_indexActiveSound
|
|
|
|
|
<< " category=" << categoryStr
|
|
|
|
|
<< " name=" << name
|
|
|
|
|
<< " egcuId=" << egcuId
|
|
|
|
@@ -711,7 +711,7 @@ void HandlerSounds::handleSoundReport(const QString &json, const QString &host)
|
|
|
|
|
(item.category() == soundState.category()) &&
|
|
|
|
|
(item.soundId() == soundState.soundId()) )
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "Sound is already on DDS-Bus";
|
|
|
|
|
DEBUG_LOG(m_logger) << "Sound is already on DDS-Bus";
|
|
|
|
|
found = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@@ -720,28 +720,28 @@ void HandlerSounds::handleSoundReport(const QString &json, const QString &host)
|
|
|
|
|
if (!found)
|
|
|
|
|
{
|
|
|
|
|
m_indexActiveSound++;
|
|
|
|
|
DEBUG_LOG() << "Sound publish";
|
|
|
|
|
DEBUG_LOG(m_logger) << "Sound publish";
|
|
|
|
|
m_ddsHandler->dtsSom()->publish(soundState);
|
|
|
|
|
m_soundStates.append(soundState);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
ERROR_LOG() << "Document is not an object";
|
|
|
|
|
ERROR_LOG(m_logger) << "Document is not an object";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (jsonStr.size() == 0)
|
|
|
|
|
DEBUG_LOG() << "No Sounds for " << host;
|
|
|
|
|
DEBUG_LOG(m_logger) << "No Sounds for " << host;
|
|
|
|
|
else
|
|
|
|
|
ERROR_LOG() << "Invalid JSON...\n" << jsonStr;
|
|
|
|
|
ERROR_LOG(m_logger) << "Invalid JSON...\n" << jsonStr;
|
|
|
|
|
}
|
|
|
|
|
m_updateActiveSoundsTimer->stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HandlerSounds::onTimerTimeout()
|
|
|
|
|
{
|
|
|
|
|
ERROR_LOG() << "Problem when querying the active sounds from the EGCU's";
|
|
|
|
|
ERROR_LOG(m_logger) << "Problem when querying the active sounds from the EGCU's";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HandlerSounds::onInstrumentationAssetChanged(const InfrastructureManagement::InstrumentationAsset &data, DataModification modType)
|
|
|
|
@@ -750,7 +750,7 @@ void HandlerSounds::onInstrumentationAssetChanged(const InfrastructureManagement
|
|
|
|
|
modType != DataModification::eModified)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
DEBUG_LOG() << "onInstrumentationAssetChanged id=" << data.id()
|
|
|
|
|
DEBUG_LOG(m_logger) << "onInstrumentationAssetChanged id=" << data.id()
|
|
|
|
|
<< " hostname=" << QString::fromStdString(data.hostname())
|
|
|
|
|
<< " mountingPointTypeId=" << data.mountingPointTypeId()
|
|
|
|
|
<< " assetStateId=" << data.assetStateId();
|
|
|
|
@@ -759,14 +759,14 @@ void HandlerSounds::onInstrumentationAssetChanged(const InfrastructureManagement
|
|
|
|
|
&& data.hostname().size() > 0)
|
|
|
|
|
{
|
|
|
|
|
QString hostname = QString::fromStdString(data.hostname());
|
|
|
|
|
DEBUG_LOG() << "m_hostnames.insert id=" << data.id()
|
|
|
|
|
DEBUG_LOG(m_logger) << "m_hostnames.insert id=" << data.id()
|
|
|
|
|
<< " hostname=" << hostname
|
|
|
|
|
<< " hostname.size=" << hostname.size()
|
|
|
|
|
<< " mountingPointTypeId=" << data.mountingPointTypeId()
|
|
|
|
|
<< " assetStateId=" << data.assetStateId();
|
|
|
|
|
if (hostname.size() > 0 )
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "insert EGCU in m_hostnames " << data.hostname();
|
|
|
|
|
DEBUG_LOG(m_logger) << "insert EGCU in m_hostnames " << data.hostname();
|
|
|
|
|
m_hostnames.insert(data.id(), QString::fromStdString(data.hostname()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -777,7 +777,7 @@ void HandlerSounds::onMountingPointAssetChanged(const InfrastructureManagement::
|
|
|
|
|
if (modType != DataModification::eAdded &&
|
|
|
|
|
modType != DataModification::eModified)
|
|
|
|
|
return;
|
|
|
|
|
DEBUG_LOG() << "onMountingPointAssetChanged"
|
|
|
|
|
DEBUG_LOG(m_logger) << "onMountingPointAssetChanged"
|
|
|
|
|
<< " id= " << data.id()
|
|
|
|
|
<< " assetId= " << data.assetId()
|
|
|
|
|
<< " structureElementId= " << data.structureElementId();
|
|
|
|
@@ -786,7 +786,7 @@ void HandlerSounds::onMountingPointAssetChanged(const InfrastructureManagement::
|
|
|
|
|
|
|
|
|
|
void HandlerSounds::onSoundStateChanged(const SoundManagement::SoundState &data, DataModification modType)
|
|
|
|
|
{
|
|
|
|
|
DEBUG_LOG() << "onSoundStateChanged"
|
|
|
|
|
DEBUG_LOG(m_logger) << "onSoundStateChanged"
|
|
|
|
|
<< " id= " << data.id()
|
|
|
|
|
<< " egcuId= " << data.egcuId()
|
|
|
|
|
<< " soundId=" << data.soundId()
|
|
|
|
|