aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/core/src/VRRequestProcessorDelegateImpl.cpp
diff options
context:
space:
mode:
authorRaquel Medina <raquel.medina@konsulko.com>2019-12-09 02:25:25 +0100
committerRaquel Medina <raquel.medina@konsulko.com>2019-12-12 01:28:06 +0100
commited834a643e3843c0f805ea33363c9f2889d2bab3 (patch)
treeb3809d3f2951d0f5a404a404d8932a88093ac2bf /src/plugins/core/src/VRRequestProcessorDelegateImpl.cpp
parent6e3e57b43693d6b07bc58a46e33fe18f0a1c5d68 (diff)
CBL: Code Based Linking in the case of Alexa voice agent, or more generally Code Based Logging. It provides a url and code which allows the user to complete the authorization process and start using the authorized voice services. - add subscribeToLoginEvents verb - add cbl events handling - include new verb in vshl-core-api.json Bug-AGL: SPEC-2981 Signed-off-by: Raquel Medina <raquel.medina@konsulko.com> Change-Id: If342d45638125682621cba707eac1d4ff5ad244c
Diffstat (limited to 'src/plugins/core/src/VRRequestProcessorDelegateImpl.cpp')
-rw-r--r--src/plugins/core/src/VRRequestProcessorDelegateImpl.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/plugins/core/src/VRRequestProcessorDelegateImpl.cpp b/src/plugins/core/src/VRRequestProcessorDelegateImpl.cpp
index 78ef10a..57fc592 100644
--- a/src/plugins/core/src/VRRequestProcessorDelegateImpl.cpp
+++ b/src/plugins/core/src/VRRequestProcessorDelegateImpl.cpp
@@ -62,6 +62,32 @@ string VRRequestProcessorDelegate::startRequestForVoiceAgent(
return newReqId;
}
+string VRRequestProcessorDelegate::loginEventsRequestForVoiceAgent(
+ shared_ptr<vshlcore::common::interfaces::IVoiceAgent> voiceAgent,
+ std::list<std::string> *args) {
+ if (!mApi) {
+ mLogger->log(Level::ERROR, TAG, "Failed to loginEventsRequestForVoiceAgent: " + voiceAgent->getId() + ", No API.");
+ return "";
+ }
+
+ // Generate a new request ID.
+ string newReqId = vshlcore::utilities::uuid::generateUUID();
+
+ // Create a new request and start listening.
+ shared_ptr<VRRequest> newRequest = VRRequest::create(mLogger, mApi, newReqId, voiceAgent);
+
+ mLogger->log(Level::DEBUG, TAG, "Starting login request with ID: " + newReqId);
+ if (!newRequest->subscribeToLoginEvents(args)) {
+ mLogger->log(Level::ERROR, TAG, "Failed to subscribe to login events.");
+ return "";
+ }
+
+ // Insert only if its started successfully.
+ mVRRequests.insert(make_pair(voiceAgent->getId(), newRequest));
+
+ return newReqId;
+}
+
void VRRequestProcessorDelegate::cancelAllRequests() {
// Cancel Pending requests
if (!mVRRequests.empty()) {