summaryrefslogtreecommitdiffstats
path: root/voice/voiceagentregistry.cpp
diff options
context:
space:
mode:
authorRaquel Medina <raquel.medina@konsulko.com>2019-12-13 22:34:58 +0100
committerRaquel Medina <raquel.medina@konsulko.com>2019-12-13 22:49:37 +0100
commit21bba7d5db82a5261ec3a5db1971985b70d49b07 (patch)
tree1fbab2d1609bddad25212cc0a8f57b7908110183 /voice/voiceagentregistry.cpp
parent9f3896cb82c27e912bc37ae88254367911050512 (diff)
fix parsing event payload in presence of '\n' chars,icefish_8.99.3icefish/8.99.38.99.3
and include signal emit for voice status and cbl changes. - fix parsing event payload in presence of whitespaces; - fix parsing voice events payload in presence of '\n' chars; - add missing model updates when status or cbl data changes; - fix authorization status enum value typo; Bug-AGL: SPEC-2981 Signed-off-by: Raquel Medina <raquel.medina@konsulko.com> Change-Id: I718bdfea1221211ed4c62ce1b695eabe83ab9590
Diffstat (limited to 'voice/voiceagentregistry.cpp')
-rw-r--r--voice/voiceagentregistry.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/voice/voiceagentregistry.cpp b/voice/voiceagentregistry.cpp
index bbd9857..62e8cd6 100644
--- a/voice/voiceagentregistry.cpp
+++ b/voice/voiceagentregistry.cpp
@@ -99,29 +99,37 @@ void VoiceAgentRegistry::setDefaultId(QString id)
void VoiceAgentRegistry::setAuthState(QString id, ServiceAuthState state)
{
- const auto stateStr =
- QMetaEnum::fromType<VoiceAgentRegistry::ServiceAuthState>().valueToKey(state);
+ QMetaEnum metaEnum = QMetaEnum::fromType<VoiceAgentRegistry::ServiceAuthState>();
+ auto stateStr = metaEnum.valueToKey(state);
VoiceAgentProfile *vap = m_model->getAgentFromId(id);
- if (vap)
+ if (vap) {
vap->setAuthState(stateStr);
+ m_model->updateAgentState(id);
+ }
}
void VoiceAgentRegistry::setConnectionState(QString id, AgentConnectionState state)
{
- const auto stateStr =
- QMetaEnum::fromType<VoiceAgentRegistry::AgentConnectionState>().valueToKey(state);
+ QMetaEnum metaEnum = QMetaEnum::fromType<VoiceAgentRegistry::AgentConnectionState>();
+ auto stateStr = metaEnum.valueToKey(state);
+
VoiceAgentProfile *vap = m_model->getAgentFromId(id);
- if (vap)
+ if (vap) {
vap->setConnState(stateStr);
+ m_model->updateAgentState(id);
+ }
}
void VoiceAgentRegistry::setDialogState(QString id, VoiceDialogState state)
{
- const auto stateStr =
- QMetaEnum::fromType<VoiceAgentRegistry::VoiceDialogState>().valueToKey(state);
+ QMetaEnum metaEnum = QMetaEnum::fromType<VoiceAgentRegistry::VoiceDialogState>();
+ auto stateStr = metaEnum.valueToKey(state);
+
VoiceAgentProfile *vap = m_model->getAgentFromId(id);
- if (vap)
+ if (vap) {
vap->setDialogState(stateStr);
+ m_model->updateAgentState(id);
+ }
}
void VoiceAgentRegistry::updateLoginData(QString id, QString code, QString url,
@@ -129,17 +137,18 @@ void VoiceAgentRegistry::updateLoginData(QString id, QString code, QString url,
{
VoiceAgentProfile *vap = m_model->getAgentFromId(id);
if (vap) {
- vap->setLoginCode(code);
+ vap->setLoginCode(url);
vap->setLoginUrl(code);
vap->setLoginPairExpired(expired);
+ m_model->updateAgentLoginData(id);
};
}
int VoiceAgentRegistry::stringToEnum(const QString key, const QString enumtype)
{
const QMetaObject *metaObject = VoiceAgentRegistry::metaObject();
- int enumIndex = metaObject->indexOfEnumerator(enumtype.toUtf8().data());
+ int enumIndex = metaObject->indexOfEnumerator(enumtype.toUtf8().constData());
QMetaEnum metaEnum = metaObject->enumerator(enumIndex);
- int value = metaEnum.keyToValue(key.toUtf8().data());
+ int value = metaEnum.keyToValue(key.toUtf8().constData());
return (value < 0)? 0 : value;
}