diff options
author | Raquel Medina <raquel.medina@konsulko.com> | 2019-12-09 18:32:02 +0100 |
---|---|---|
committer | Raquel Medina <raquel.medina@konsulko.com> | 2019-12-12 02:18:37 +0100 |
commit | 0ff12f7c22e2be3238b0c436c08634cd18f5bd06 (patch) | |
tree | 6699d634a1952a62ee4315a71aa60c7405bd48a4 /voice/voicemessage.h | |
parent | c4e293365c1a16135d49af3bf6de173547326f79 (diff) |
voice: remove vshl-capabilities dependencies
Various fixes for voice component:
- fix incorrect check on vap (voice agent profile) pointers;
- remove dependencies on vshl-capabilities: this module will
communicate via vshl-core api;
- remove dependencis on alexa-voiceagent;
- use a more generic name for cbl related operations. CBL
in this environment is understood as code based
login (for voice agent authorization via user login to a cloud
service), however, in the case of alexa it is known as code
based linking;
- add check for voice_xxx_event eventdata which in ocasions
is an empty object, i.e., the payload is missing.
Bug-AGL: SPEC-2981
Signed-off-by: Raquel Medina <raquel.medina@konsulko.com>
Change-Id: Icaab7a21bedb3e2696d541567162ec46b047a305
Diffstat (limited to 'voice/voicemessage.h')
-rw-r--r-- | voice/voicemessage.h | 73 |
1 files changed, 8 insertions, 65 deletions
diff --git a/voice/voicemessage.h b/voice/voicemessage.h index 00ed847..27aa06d 100644 --- a/voice/voicemessage.h +++ b/voice/voicemessage.h @@ -24,24 +24,15 @@ class VoiceMessage : public Message Q_OBJECT public: virtual ~VoiceMessage() {}; - virtual bool isAuthStateEvent() const = 0; - virtual bool isConnectionStateEvent() const = 0; - virtual bool isDialogStateEvent() const = 0; - virtual bool createRequest(QString verb, QJsonObject parameter) = 0; -}; - -class VshlCoreVoiceMessage : public VoiceMessage -{ - Q_OBJECT - public: - virtual ~VshlCoreVoiceMessage() {}; - bool isAuthStateEvent() const override { + bool isAuthStateEvent() const { return (this->eventName().contains("voice_authstate_event")); }; - bool isConnectionStateEvent() const override { + bool isConnectionStateEvent() const { return (this->eventName().contains("voice_connectionstate_event")); }; - bool isDialogStateEvent() const override { + bool isDialogStateEvent() const { return (this->eventName().contains("voice_dialogstate_event")); }; - bool createRequest(QString verb, QJsonObject parameter) override; + bool isCblEvent() const { + return (this->eventName().contains("cbl")); }; + bool createRequest(QString verb, QJsonObject parameter); private: QStringList verbs { @@ -51,64 +42,16 @@ class VshlCoreVoiceMessage : public VoiceMessage "unsubscribe", "enumerateVoiceAgents", "setDefaultVoiceAgent", + "subscribeToLoginEvents", }; QStringList events { "voice_authstate_event", "voice_dialogstate_event", "voice_connectionstate_event", - }; -}; - -class VshlCpbltsVoiceMessage : public VoiceMessage -{ - Q_OBJECT - public: - virtual ~VshlCpbltsVoiceMessage() {}; - bool isAuthStateEvent() const override { return false; }; - bool isConnectionStateEvent() const override { return false; }; - bool isDialogStateEvent() const override { return false; }; - bool createRequest(QString verb, QJsonObject parameter) override; - - private: - QStringList verbs { - "guiMetadataSubscribe", - "guiMetadataPublish", - "phonecontrolSubscribe", - "phonecontrolPublish", - "navigationSubscribe", - "navigationPublish", - "playbackControllerSubscribe", - "playbackControllerPublish", - }; - QStringList events { - "voice_authstate_event", - "voice_dialogstate_event", - "voice_connectionstate_event", - }; -}; - -/* We shouldnt access an agent directly, but CBL events - * are not abstracted/forwarded by vshl bindings. - */ -class AlexaVoiceMessage : public VoiceMessage -{ - Q_OBJECT - public: - virtual ~AlexaVoiceMessage() {}; - bool isAuthStateEvent() const override { - return (events.contains(this->eventName())); }; - bool isConnectionStateEvent() const override { return false; }; - bool isDialogStateEvent() const override { return false; }; - bool createRequest(QString verb, QJsonObject parameter) override; - - private: - QStringList verbs { - "subscribeToCBLEvents", - }; - QStringList events { "voice_cbl_codepair_received_event", "voice_cbl_codepair_expired_event", }; }; + #endif // VOICE_MESSAGE_H |