From ed834a643e3843c0f805ea33363c9f2889d2bab3 Mon Sep 17 00:00:00 2001 From: Raquel Medina Date: Mon, 9 Dec 2019 02:25:25 +0100 Subject: Add CBL processing 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 Change-Id: If342d45638125682621cba707eac1d4ff5ad244c --- .../core/src/VRRequestProcessorDelegateImpl.cpp | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/plugins/core/src/VRRequestProcessorDelegateImpl.cpp') 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 voiceAgent, + std::list *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 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()) { -- cgit 1.2.3-korg