From 01c999956ea5fba52c4eaf35998c023047587171 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Tue, 15 Oct 2019 19:57:24 -0400 Subject: Rework to remove Alexa voiceagent dependencies Changes include: - The previous somewhat hard-coded Alexa voiceagent configuration in the app controller definition has been replaced with a scheme that allows instead specifying voiceagent configuration via the configuration file /etc/xdg/AGL/voice-high.json, and individual per-voiceagent configuration via JSON files in the directory /etc/xdg/AGL/voiceagents. See the updated README.md for more details. - The new file reading code for the above change was facilitated by bumping the C++ standard option to 17 (from 11) to allow use of the new standard library filesystem classes. - The configured voiceagents' APIs are now loaded dynamically using the afb_api_require_api call enabled by the recently exposed platform:apis:auto-ws widget permission. The widget configuration has been updated to add the permission, and also remove the previously hard-code dependency on the "alexa-voiceagent" API. - App controller event hooks are created dynamically for the events from the configured voiceagents. This is done by calling back into the app controller API at the appropriate place during initialization, replacing the previous hard-coding of events from "alexa-voiceagent". If future use cases require dynamic removal of voiceagents, then this scheme will need to be revisited, as the app controller API currently has no provision for removing events. - The IAFBApi interdace and AFBApiImpl implementation classes have been extended with additional getApi and requireApi calls to enable the above changes in a straightforward manner. Bug-AGL: SPEC-2898 Signed-off-by: Scott Murray Change-Id: Iae8b99a6286174510e88d8eeffd51718db64f2f4 (cherry picked from commit d75ca330180e943df28435705d36c9e435759de2) --- src/plugins/interfaces/afb/IAFBApi.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/plugins/interfaces') diff --git a/src/plugins/interfaces/afb/IAFBApi.h b/src/plugins/interfaces/afb/IAFBApi.h index ba0de72..32e459e 100644 --- a/src/plugins/interfaces/afb/IAFBApi.h +++ b/src/plugins/interfaces/afb/IAFBApi.h @@ -1,5 +1,6 @@ /* * Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2019 Konsulo Group * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. @@ -18,6 +19,12 @@ #include #include +extern "C" { +#define AFB_BINDING_VERSION 3 + +#include +} + #include using namespace std; @@ -80,6 +87,8 @@ public: virtual bool unsubscribe(IAFBRequest& request) = 0; }; + virtual afb_api_t getApi() = 0; + virtual std::shared_ptr createEvent(const std::string& eventName) = 0; virtual int callSync( @@ -89,6 +98,10 @@ public: struct json_object** result, std::string& error, std::string& info) = 0; + + virtual int requireApi( + const std::string& api, + const bool initialize) = 0; }; } // namespace interfaces -- cgit 1.2.3-korg