aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/afb
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-10-15 19:57:24 -0400
committerScott Murray <scott.murray@konsulko.com>2019-10-15 19:57:24 -0400
commitd75ca330180e943df28435705d36c9e435759de2 (patch)
treeb61fbf25886d3815b6d3d480512f61ddf3794243 /src/plugins/afb
parent0a7e93d37803ba31b18c7199cb1efc10ec83e0cc (diff)
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 <scott.murray@konsulko.com> Change-Id: Iae8b99a6286174510e88d8eeffd51718db64f2f4
Diffstat (limited to 'src/plugins/afb')
-rw-r--r--src/plugins/afb/AFBApiImpl.cpp12
-rw-r--r--src/plugins/afb/AFBApiImpl.h10
2 files changed, 12 insertions, 10 deletions
diff --git a/src/plugins/afb/AFBApiImpl.cpp b/src/plugins/afb/AFBApiImpl.cpp
index c4cc1b1..d7c1fcf 100644
--- a/src/plugins/afb/AFBApiImpl.cpp
+++ b/src/plugins/afb/AFBApiImpl.cpp
@@ -19,12 +19,6 @@
#include "afb/include/AFBEventImpl.h"
#include "utilities/logging/Logger.h"
-extern "C" {
-#define AFB_BINDING_VERSION 3
-
-#include <afb/afb-binding.h>
-}
-
static std::string TAG = "vshlcore::afb::AFBApiImpl";
/**
@@ -74,5 +68,11 @@ int AFBApiImpl::callSync(
return rc;
}
+int AFBApiImpl::requireApi(
+ const std::string& api,
+ const bool initialize) {
+ return afb_api_require_api(mApi, api.c_str(), initialize);
+}
+
} // namespace afb
} // namespace vshl
diff --git a/src/plugins/afb/AFBApiImpl.h b/src/plugins/afb/AFBApiImpl.h
index c0c7dd5..2ffa4a5 100644
--- a/src/plugins/afb/AFBApiImpl.h
+++ b/src/plugins/afb/AFBApiImpl.h
@@ -18,10 +18,6 @@
#include <memory>
-extern "C" {
-#include "ctl-plugin.h"
-}
-
#include "interfaces/afb/IAFBApi.h"
#include "interfaces/utilities/logging/ILogger.h"
@@ -35,6 +31,8 @@ public:
~AFBApiImpl();
+ afb_api_t getApi() { return mApi; };
+
std::shared_ptr<IAFBEvent> createEvent(const std::string& eventName) override;
int callSync(
@@ -45,6 +43,10 @@ public:
std::string& error,
std::string& info) override;
+ int requireApi(
+ const std::string& api,
+ const bool initialize) override;
+
private:
AFBApiImpl(afb_api_t api);