diff options
author | Scott Murray <scott.murray@konsulko.com> | 2019-10-15 19:57:24 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2019-10-15 19:57:24 -0400 |
commit | d75ca330180e943df28435705d36c9e435759de2 (patch) | |
tree | b61fbf25886d3815b6d3d480512f61ddf3794243 /README.md | |
parent | 0a7e93d37803ba31b18c7199cb1efc10ec83e0cc (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 'README.md')
-rw-r--r-- | README.md | 87 |
1 files changed, 84 insertions, 3 deletions
@@ -1,4 +1,4 @@ -# 1. High Level Voice Service Core (VSHL-CORE) +# 1. High Level Voice Service Core (VSHL-CORE) This repository hosts the code for the AGL's high level voice service's core request arbitration binding also known as VSHL-CORE. Please refer to the [architecture](https://confluence.automotivelinux.org/display/SPE/Speech+EG+Architecture) for more information. @@ -14,7 +14,7 @@ pushd $MY_PROJECTS_DIR git clone --recursive https://gerrit.automotivelinux.org/gerrit/apps/agl-service-voice-high-core ``` -# 4. Renesas R-Car M3 board +# 4. Renesas R-Car M3/H3 board ## 4.1 Building VSHL Core ``` @@ -34,6 +34,87 @@ popd # afm-util install vshl-core.wgt # afm-util start vshl-core@1.0 ``` +## 4.3 Voiceagent Configuration +The binding's voiceagent configuration can be provided in three ways. Via the binding's app controller JSON configuration, the file /etc/xdg/AGL/voice-high.json, or as separate per-voiceagent JSON files in /etc/xdg/AGL/voiceagents/. These will be discussed in the following sections. + +### 4.3.1 App Controller Voiceagent Configuration +The original method of providing per-voiceagent configuration and setting the default voiceagent was via the binding's app-controller JSON configuration, which is located in conf.d/project/etc/vshl-core-api.json in the source tree. This configuration file defines the runtime configuration of the binding used by the app-controller library, and voiceagent configuration was, and still can be, provided via the "args" parameter for the controller's "onload" definition for the "loadVoiceAgentsConfig" entry point in the vshl-core plugin. The original hard-coded configuration for the Alexa voiceagent looked like this: +``` +"onload": [{ + "uid": "loadVoiceAgentsConfig", + "info": "Loading the information about voice agents managed by the high level voice service.", + "action": "plugin://vshl-core#loadVoiceAgentsConfig", + "args": { + "default": "VA-001", + "agents": [ + { + "id": "VA-001", + "active": true, + "name": "Alexa", + "api": "alexa-voiceagent", + "wakewords": [ + "alexa", + "computer", + "echo" + ], + "activewakeword": "alexa", + "description": "Alexa voice assistant by Amazon.", + "vendor": "Amazon.com Services Inc" + } + ] + } +}], +``` +The "args" definition has now been removed in favor of the flexibility provided by the following options, but can still be added back if required for a future use case. + +### 4.3.2 /etc/xdg/AGL/voice-high.json +The file /etc/xdg/AGL/voice-high.json can be considered a replacement for the configuration previously provided in the "args" to "loadVoiceAgentsConfig" in the controller configuration. Its syntax is the same, so the following voice-high.json contents will produce the same final binding configuration: +``` +{ + "default": "VA-001", + "agents": [ + { + "id": "VA-001", + "active": true, + "name": "Alexa", + "api": "alexa-voiceagent", + "wakewords": [ + "alexa", + "computer", + "echo" + ], + "activewakeword": "alexa", + "description": "Alexa voice assistant by Amazon.", + "vendor": "Amazon.com Services Inc" + } + ] +} +``` +The configuration parsing, however, allows omitting the list of voiceagents, so in practice the per-voiceagent configuration files described next would preferably be used with a simpler voice-high.json file that just defines the default voiceagent, e.g.: +``` +{ "default": "VA-001" } +``` +Note that the binding does allow operation with no voiceagents as well as no default voiceagent configured. As well, since the voiceagent API specified by name in the "api" field is loaded dynamically, there currently is a constraint that the providing voiceagent binding be running before vshl-core. + +### 4.3.3 /etc/xdg/AGL/voiceagents +The final option for providing just per-voiceagent configuration is to place a JSON file containing its configuration in the directory /etc/xdg/AGL/voiceagents. All readable files in the directory with the .json extension will be read and validated as possible voiceagent configurations. The contents are just the "agents" field of the previous configurations, so for the Alexa voiceagent example above, the JSON would be: +``` +{ + "id": "VA-001", + "active": true, + "name": "Alexa", + "api": "alexa-voiceagent", + "wakewords": [ + "alexa", + "computer", + "echo" + ], + "activewakeword": "alexa", + "description": "Alexa voice assistant by Amazon.", + "vendor": "Amazon.com Services Inc" +} +``` +Note that for conflicting voiceagent definitions with the same "id", the first configuration parsed will be used, and the parsing ordering follows what has been outlined above, i.e. controller JSON configuration, then voice-high.json, then any per-voiceagent configuration JSON files. However, the value of the default voiceagent, if any, provided by the controller JSON configuration, may be over-ridden by the value in voice-high.json. # 5. Ubuntu 16.04 ## 5.1 Building VSHL Core @@ -92,4 +173,4 @@ It will also give you the option to apply a patch (it creates a patch in /tmp fo git apply /tmp/<patch> git add <source files> git commit -```
\ No newline at end of file +``` |