├── plugins ├── alexaauth │ ├── qmldir │ ├── alexaauth.pro │ ├── alexaauth_plugin.cpp │ ├── alexaauth_plugin.h │ ├── alexaauth.h │ └── alexaauth.cpp ├── alexainterface │ ├── qmldir │ ├── alexainterface_plugin.h │ ├── BaseCard.cpp │ ├── SampleEqualizerModeController.cpp │ ├── alexainterface_plugin.cpp │ ├── BaseCard.h │ ├── vehicleintentcard.h │ ├── vehicleintentcard.cpp │ ├── SampleEqualizerModeController.h │ ├── DialogStateManager.cpp │ ├── alexainterface.pro │ ├── DialogStateManager.h │ ├── myfeatures.prf │ ├── InfoCard.h │ ├── ObserverManager.cpp │ ├── KeywordObserver.cpp │ ├── CapabilitiesManager.cpp │ ├── ObserverManager.h │ ├── KeywordObserver.h │ ├── CapabilitiesManager.h │ ├── WeatherCard.h │ ├── GuiRenderer.h │ ├── InfoCard.cpp │ ├── WeatherCard.cpp │ ├── ConnectionManager.cpp │ ├── PortAudioMicrophoneWrapper.h │ ├── ConnectionManager.h │ ├── AuthManager.cpp │ ├── QtMicrophoneWrapper.h │ ├── AuthManager.h │ ├── PortAudioMicrophoneWrapper.cpp │ ├── InteractionManager.h │ └── InteractionManager.cpp └── plugins.pro ├── app ├── icon.png ├── info.yaml ├── app.pro ├── BasicCard.qml ├── main.qml ├── InfoCard.qml ├── Header.qml ├── SettingsView.qml ├── WeatherCard.qml ├── AuthWebPageInteraction.qml ├── MainView.qml └── AuthView.qml ├── gfx ├── logo.png ├── spinner.png ├── ic-logo_ON.png ├── ic-logo_OFF.png ├── ic_clipboard.png ├── ic_speaking.png ├── ic_thinking.png ├── ic-settings_OFF.png ├── ic-settings_ON.png ├── ic_microphone.png └── alexa_background.png ├── database ├── alerts.db ├── settings.db ├── miscDatabase.db ├── notifications.db ├── cblAuthDelegate.db ├── certifiedsender.db └── deviceSettings.db ├── kwd ├── alexa.umdl └── common.res ├── .gitattributes ├── .gitignore ├── com.luxoft.alexa.pro ├── conf └── AlexaClientSDKConfig.json └── README.md /plugins/alexaauth/qmldir: -------------------------------------------------------------------------------- 1 | module alexaauth 2 | plugin alexaauth 3 | -------------------------------------------------------------------------------- /app/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/app/icon.png -------------------------------------------------------------------------------- /gfx/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/gfx/logo.png -------------------------------------------------------------------------------- /plugins/alexainterface/qmldir: -------------------------------------------------------------------------------- 1 | module alexainterface 2 | plugin alexainterface 3 | -------------------------------------------------------------------------------- /gfx/spinner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/gfx/spinner.png -------------------------------------------------------------------------------- /database/alerts.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/database/alerts.db -------------------------------------------------------------------------------- /gfx/ic-logo_ON.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/gfx/ic-logo_ON.png -------------------------------------------------------------------------------- /database/settings.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/database/settings.db -------------------------------------------------------------------------------- /gfx/ic-logo_OFF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/gfx/ic-logo_OFF.png -------------------------------------------------------------------------------- /gfx/ic_clipboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/gfx/ic_clipboard.png -------------------------------------------------------------------------------- /gfx/ic_speaking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/gfx/ic_speaking.png -------------------------------------------------------------------------------- /gfx/ic_thinking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/gfx/ic_thinking.png -------------------------------------------------------------------------------- /gfx/ic-settings_OFF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/gfx/ic-settings_OFF.png -------------------------------------------------------------------------------- /gfx/ic-settings_ON.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/gfx/ic-settings_ON.png -------------------------------------------------------------------------------- /gfx/ic_microphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/gfx/ic_microphone.png -------------------------------------------------------------------------------- /database/miscDatabase.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/database/miscDatabase.db -------------------------------------------------------------------------------- /database/notifications.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/database/notifications.db -------------------------------------------------------------------------------- /plugins/plugins.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS = \ 3 | alexaauth \ 4 | alexainterface 5 | 6 | -------------------------------------------------------------------------------- /database/cblAuthDelegate.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/database/cblAuthDelegate.db -------------------------------------------------------------------------------- /database/certifiedsender.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/database/certifiedsender.db -------------------------------------------------------------------------------- /database/deviceSettings.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtvoiceassistant/master/database/deviceSettings.db -------------------------------------------------------------------------------- /kwd/alexa.umdl: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:1132440e7b47f6dd011ebc4185e57107eab7d5d01d6496b7344ecaac128d3e8d 3 | size 2254661 4 | -------------------------------------------------------------------------------- /kwd/common.res: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:5dd5258678182f2e055fa7a6167eba50ded3bf8b41f70faab11fd9b221de488b 3 | size 487498 4 | -------------------------------------------------------------------------------- /gfx/alexa_background.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:e84a5dd46fe22e0b5fe6d8423c362d78ce7c54acc97e72b1ca6d5f78da83905e 3 | size 504206 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | gfx/alexa_background.png filter=lfs diff=lfs merge=lfs -text 2 | kwd/alexa.umdl filter=lfs diff=lfs merge=lfs -text 3 | kwd/common.res filter=lfs diff=lfs merge=lfs -text 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .qmake.stash 2 | .build 3 | Makefile 4 | *.pro.user* 5 | package-tmp/ 6 | moc_*.cpp 7 | *.o 8 | plugins/*/.moc/ 9 | plugins/alexaauth/libalexaauth.so 10 | plugins/alexainterface/libalexainterface.so 11 | 12 | -------------------------------------------------------------------------------- /app/info.yaml: -------------------------------------------------------------------------------- 1 | formatVersion: 1 2 | formatType: am-application 3 | --- 4 | id: 'com.luxoft.alexa' 5 | icon: 'icon.png' 6 | runtime: qml 7 | code: main.qml 8 | runtimeParameters: 9 | importPaths: [ '.' , "./imports"] 10 | environmentVariables: 11 | ALEXA_SDK_CONFIG_FILE: ./conf/AlexaClientSDKConfig.json 12 | ALEXA_KWD_MODEL_PATH: ./kwd 13 | name: 14 | en: 'Alexa' 15 | de: 'Alexa' 16 | 17 | categories: [ 'other' ] 18 | -------------------------------------------------------------------------------- /com.luxoft.alexa.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += plugins \ 4 | app 5 | 6 | app.depends = plugins 7 | 8 | AM_MANIFEST = $$PWD/app/info.yaml 9 | AM_PACKAGE_DIR = /apps/com.luxoft.alexa 10 | 11 | !packagesExist(AlexaClientSDK) { 12 | log("$$escape_expand(\\n\\n) *** No Alexa Client SDK package available: Make sure Alexa Client SDK is installed and configured correctly ***") 13 | log("$$escape_expand(\n) *** Please refer to README.md for more information and instructions ***$$escape_expand(\\n\\n)") 14 | } 15 | 16 | load(am-app) 17 | -------------------------------------------------------------------------------- /plugins/alexaauth/alexaauth.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = lib 2 | TARGET = alexaauth 3 | QT += qml quick webengine 4 | 5 | CONFIG += plugin c++14 6 | 7 | TARGET = $$qtLibraryTarget($$TARGET) 8 | uri = alexaauth 9 | 10 | HEADERS += \ 11 | alexaauth_plugin.h \ 12 | alexaauth.h 13 | 14 | SOURCES += \ 15 | alexaauth_plugin.cpp \ 16 | alexaauth.cpp 17 | 18 | MOC_DIR = .moc 19 | OBJECTS_DIR = .obj 20 | 21 | DISTFILES = qmldir 22 | 23 | qmldir.files = qmldir 24 | 25 | unix { 26 | installPath = $$INSTALL_PREFIX/apps/com.luxoft.alexa/imports/alexaauth 27 | qmldir.path = $$installPath 28 | target.path = $$installPath 29 | 30 | INSTALLS += target qmldir 31 | } 32 | -------------------------------------------------------------------------------- /app/app.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = aux 2 | 3 | QT += quick widgets 4 | 5 | FILES += info.yaml \ 6 | icon.png \ 7 | main.qml \ 8 | Header.qml \ 9 | AlexaView.qml \ 10 | AuthView.qml \ 11 | BasicCard.qml \ 12 | Footer.qml \ 13 | WeatherCard.qml \ 14 | InfoCard.qml \ 15 | MainView.qml \ 16 | AuthWebPageInteraction.qml \ 17 | SettingsView.qml 18 | 19 | app.files = $$FILES 20 | app.path = $$INSTALL_PREFIX/apps/com.luxoft.alexa 21 | 22 | assets.files = ./../gfx/*.png 23 | assets.path = $$INSTALL_PREFIX/apps/com.luxoft.alexa/assets 24 | 25 | conf.files = ./../conf/AlexaClientSDKConfig.json 26 | conf.path = $$INSTALL_PREFIX/apps/com.luxoft.alexa/conf 27 | 28 | database.files = ./../database 29 | database.path = $$INSTALL_PREFIX/apps/com.luxoft.alexa 30 | 31 | INSTALLS += app assets conf database 32 | 33 | OTHER_FILES += $$FILES 34 | -------------------------------------------------------------------------------- /conf/AlexaClientSDKConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "cblAuthDelegate":{ 3 | "databaseFilePath":"database/cblAuthDelegate.db" 4 | }, 5 | "deviceInfo":{ 6 | "deviceSerialNumber":"123456", 7 | "clientId":"amzn1.application-oa2-client.a92e3edd0c8542a6bafcd89e5f125851", 8 | "productId":"QtAutoAlexa" 9 | }, 10 | "capabilitiesDelegate":{ 11 | "capabilities":[ 12 | { 13 | "type": "AlexaInterface", 14 | "interface": "InteractionModel", 15 | "version": "1.0" 16 | } 17 | ] 18 | }, 19 | "miscDatabase":{ 20 | "databaseFilePath":"database/miscDatabase.db" 21 | }, 22 | "alertsCapabilityAgent":{ 23 | "databaseFilePath":"database/alerts.db" 24 | }, 25 | "settings":{ 26 | "databaseFilePath":"database/settings.db", 27 | "defaultAVSClientSettings":{ 28 | "locale":"en-US" 29 | } 30 | }, 31 | "deviceSettings":{ 32 | "databaseFilePath":"database/deviceSettings.db" 33 | }, 34 | "bluetooth" : { 35 | "databaseFilePath":"database/bluetooth.db" 36 | }, 37 | "certifiedSender":{ 38 | "databaseFilePath":"database/certifiedsender.db" 39 | }, 40 | "notifications":{ 41 | "databaseFilePath":"database/notifications.db" 42 | }, 43 | "sampleApp":{ 44 | "displayCardsSupported":true 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /plugins/alexaauth/alexaauth_plugin.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 IVI UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #include "alexaauth_plugin.h" 33 | #include "alexaauth.h" 34 | 35 | #include 36 | 37 | void AlexaAuthPlugin::registerTypes(const char *uri) 38 | { 39 | qmlRegisterSingletonType(uri, 1, 0, "AlexaAuth", alexaAuthSingletonProvider); 40 | } 41 | 42 | -------------------------------------------------------------------------------- /plugins/alexainterface/alexainterface_plugin.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #pragma once 33 | 34 | #include 35 | 36 | class AlexaPlugin : public QQmlExtensionPlugin 37 | { 38 | Q_OBJECT 39 | Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) 40 | 41 | public: 42 | void registerTypes(const char *uri); 43 | }; 44 | -------------------------------------------------------------------------------- /plugins/alexaauth/alexaauth_plugin.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #pragma once 33 | 34 | #include 35 | 36 | class AlexaAuthPlugin : public QQmlExtensionPlugin 37 | { 38 | Q_OBJECT 39 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 40 | 41 | public: 42 | void registerTypes(const char *uri); 43 | }; 44 | -------------------------------------------------------------------------------- /plugins/alexainterface/BaseCard.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #include "BaseCard.h" 33 | #include 34 | 35 | BaseCard::BaseCard(QObject *parent) : QObject(parent) 36 | { 37 | } 38 | 39 | void BaseCard::setType(Type type) 40 | { 41 | if (m_type == type) 42 | return; 43 | 44 | m_type = type; 45 | Q_EMIT typeChanged(m_type); 46 | } 47 | -------------------------------------------------------------------------------- /plugins/alexainterface/SampleEqualizerModeController.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #include 33 | #include 34 | #include "SampleEqualizerModeController.h" 35 | 36 | namespace alexaClientSDK { 37 | 38 | using namespace avsCommon::sdkInterfaces::audio; 39 | 40 | std::shared_ptr SampleEqualizerModeController::create() { 41 | return std::shared_ptr(new SampleEqualizerModeController()); 42 | } 43 | 44 | bool SampleEqualizerModeController::setEqualizerMode(EqualizerMode /*mode*/) { 45 | //ConsolePrinter::prettyPrint("Equalizer Mode changed to '" + equalizerModeToString(mode) + "'"); 46 | return true; 47 | } 48 | 49 | } // namespace alexaClientSDK 50 | -------------------------------------------------------------------------------- /plugins/alexainterface/alexainterface_plugin.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #include "alexainterface_plugin.h" 33 | #include "WeatherCard.h" 34 | #include "BaseCard.h" 35 | 36 | #include 37 | 38 | #include "AlexaInterface.h" 39 | #include "InfoCard.h" 40 | 41 | void AlexaPlugin::registerTypes(const char *uri) 42 | { 43 | // @uri alexa 44 | qmlRegisterSingletonType(uri, 1, 0, "AlexaInterface", alexaInterfaceSingletonProvider); 45 | qmlRegisterUncreatableType(uri, 1, 0, "Alexa", "Non instantiable type"); 46 | qmlRegisterUncreatableType(uri, 1, 0, "InfoCard", "Non instantiable type"); 47 | qmlRegisterUncreatableType(uri, 1, 0, "WeatherCard", "Non instantiable type"); 48 | qmlRegisterUncreatableType(uri, 1, 0, "BaseCard", "Non instantiable type"); 49 | } 50 | 51 | -------------------------------------------------------------------------------- /plugins/alexainterface/BaseCard.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #ifndef BASECARD_H 33 | #define BASECARD_H 34 | 35 | #include 36 | #include 37 | 38 | class BaseCard : public QObject 39 | { 40 | Q_OBJECT 41 | Q_PROPERTY(Type type READ type WRITE setType NOTIFY typeChanged) 42 | 43 | public: 44 | enum Type { 45 | Weather, 46 | Info, 47 | VehicleIntent, 48 | Unknown 49 | }; 50 | Q_ENUM(Type) 51 | 52 | explicit BaseCard(QObject *parent = nullptr); 53 | 54 | void setType(Type type); 55 | Type type() const { return m_type; } 56 | 57 | virtual void setJsonDocument(QJsonDocument jsonDocument) = 0; 58 | 59 | Q_SIGNALS: 60 | void typeChanged(Type type); 61 | 62 | public Q_SLOTS: 63 | 64 | private: 65 | Type m_type = Type::Unknown; 66 | }; 67 | 68 | #endif // BASECARD_H 69 | -------------------------------------------------------------------------------- /plugins/alexainterface/vehicleintentcard.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #ifndef VEHICLEINTENTCARD_H 33 | #define VEHICLEINTENTCARD_H 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include "BaseCard.h" 40 | 41 | 42 | class VehicleIntentCard : public BaseCard 43 | { 44 | Q_OBJECT 45 | 46 | Q_PROPERTY(QString action READ action NOTIFY actionChanged) 47 | Q_PROPERTY(QString side READ side NOTIFY sideChanged) 48 | Q_PROPERTY(QString part READ part NOTIFY partChanged) 49 | 50 | public: 51 | 52 | explicit VehicleIntentCard(QObject *parent = nullptr); 53 | void setJsonDocument(QJsonDocument jsonDocument) override; 54 | 55 | QString action() const; 56 | QString side() const; 57 | QString part() const; 58 | Q_SIGNALS: 59 | void actionChanged(); 60 | void sideChanged(); 61 | void partChanged(); 62 | 63 | private: 64 | QString m_action = QStringLiteral("unknown"); 65 | QString m_side = QStringLiteral("unknown"); 66 | QString m_part = QStringLiteral("unknown"); 67 | }; 68 | 69 | #endif // VEHICLEINTENTCARD_H 70 | -------------------------------------------------------------------------------- /plugins/alexainterface/vehicleintentcard.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #include "vehicleintentcard.h" 33 | #include 34 | 35 | VehicleIntentCard::VehicleIntentCard(QObject *parent) 36 | : BaseCard(parent) 37 | { 38 | setType(BaseCard::VehicleIntent); 39 | 40 | } 41 | 42 | void VehicleIntentCard::setJsonDocument(QJsonDocument jsonDocument) 43 | { 44 | QJsonObject jsonObj = jsonDocument.object(); 45 | 46 | QString jsonString = jsonObj["textField"].toString(); 47 | 48 | QJsonDocument doc = QJsonDocument::fromJson(jsonString.toUtf8()); 49 | QJsonObject obj = doc.object(); 50 | 51 | //TODO: check for matching 52 | 53 | m_action = obj["slots"].toObject()["action"].toObject()["value"].toString(); 54 | m_side = obj["slots"].toObject()["side"].toObject()["value"].toString(); 55 | m_part = obj["slots"].toObject()["part"].toObject()["value"].toString(); 56 | 57 | Q_EMIT actionChanged(); 58 | Q_EMIT sideChanged(); 59 | Q_EMIT partChanged(); 60 | } 61 | 62 | QString VehicleIntentCard::action() const{ 63 | return m_action; 64 | } 65 | 66 | QString VehicleIntentCard::side() const{ 67 | return m_side; 68 | } 69 | 70 | QString VehicleIntentCard::part() const{ 71 | return m_part; 72 | } 73 | -------------------------------------------------------------------------------- /plugins/alexainterface/SampleEqualizerModeController.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #ifndef SAMPLE_EQUALIZER_MODE_CONTROLLER_H_ 33 | #define SAMPLE_EQUALIZER_MODE_CONTROLLER_H_ 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | #include 40 | 41 | namespace alexaClientSDK { 42 | 43 | /** 44 | * Sample implementation of @c EqualizerModeControllerInterface that prints the mode requested to console. 45 | */ 46 | class SampleEqualizerModeController : public avsCommon::sdkInterfaces::audio::EqualizerModeControllerInterface { 47 | public: 48 | /** 49 | * Factory method. 50 | * 51 | * @return An instance of @c SampleEqualizerModeController. 52 | */ 53 | static std::shared_ptr create(); 54 | 55 | /// @name EqualizerModeControllerInterface methods 56 | /// @{ 57 | 58 | bool setEqualizerMode(avsCommon::sdkInterfaces::audio::EqualizerMode mode) override; 59 | 60 | ///@} 61 | 62 | private: 63 | /** 64 | * Constructor. 65 | */ 66 | SampleEqualizerModeController() = default; 67 | }; 68 | 69 | } // namespace alexaClientSDK 70 | 71 | #endif // SAMPLE_EQUALIZER_MODE_CONTROLLER_H_ 72 | -------------------------------------------------------------------------------- /plugins/alexainterface/DialogStateManager.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #include "DialogStateManager.h" 33 | 34 | DialogStateManager::DialogStateManager(QObject* parent) : QObject (parent) 35 | { 36 | } 37 | 38 | void DialogStateManager::onDialogUXStateChanged(DialogUXState state) 39 | { 40 | m_executor.submit([this, state]() { 41 | 42 | DialogState thisState = DialogState::Idle; 43 | if (state == alexaClientSDK::avsCommon::sdkInterfaces::DialogUXStateObserverInterface::DialogUXState::LISTENING) { 44 | thisState = DialogState::Listening; 45 | } else if (state == alexaClientSDK::avsCommon::sdkInterfaces::DialogUXStateObserverInterface::DialogUXState::THINKING) { 46 | thisState = DialogState::Thinking; 47 | } else if (state == alexaClientSDK::avsCommon::sdkInterfaces::DialogUXStateObserverInterface::DialogUXState::SPEAKING) { 48 | thisState = DialogState::Speaking; 49 | } else if (state == alexaClientSDK::avsCommon::sdkInterfaces::DialogUXStateObserverInterface::DialogUXState::FINISHED) { 50 | thisState = DialogState::Finished; 51 | } 52 | 53 | if (m_dialogState == thisState) { 54 | return; 55 | } 56 | 57 | m_dialogState = thisState; 58 | Q_EMIT dialogStateChanged(); 59 | }); 60 | } 61 | -------------------------------------------------------------------------------- /plugins/alexainterface/alexainterface.pro: -------------------------------------------------------------------------------- 1 | # The Alexa SDK must be built before building this plugin 2 | CONFIG += link_pkgconfig 3 | PKGCONFIG += gstreamer-1.0 4 | PKGCONFIG += glib-2.0 5 | 6 | packagesExist(AlexaClientSDK) { 7 | PKGCONFIG += AlexaClientSDK 8 | } 9 | 10 | # Use this only if SDK is built with KWD support 11 | USE_WAKEUP_WORD = 1 12 | 13 | # Specify if the libraries headers use the old or new ABI 14 | DEFINES += _GLIBCXX_USE_CXX11_ABI=1 15 | 16 | #----------------------------- 17 | TEMPLATE = lib 18 | QT += qml quick multimedia widgets network 19 | CONFIG += plugin c++11 no_keywords 20 | 21 | include(myfeatures.prf) 22 | 23 | 24 | printLine() 25 | equals(USE_WAKEUP_WORD, 0) { 26 | printLine("Use a wakeup word", "Yes") 27 | DEFINES += KWD 28 | } else { 29 | DEFINES -= KWD 30 | printLine("Use a wakeup word", "No") 31 | } 32 | 33 | 34 | INCLUDEPATH += SampleApp/ 35 | 36 | 37 | TARGET = $$qtLibraryTarget($$TARGET) 38 | uri = alexainterface 39 | 40 | MOC_DIR = .moc 41 | OBJECTS_DIR = .obj 42 | 43 | DEFINES += RAPIDJSON_HAS_STDSTRING 44 | 45 | SOURCES += \ 46 | AuthManager.cpp \ 47 | ConnectionManager.cpp \ 48 | alexainterface_plugin.cpp \ 49 | InteractionManager.cpp \ 50 | KeywordObserver.cpp \ 51 | GuiRenderer.cpp \ 52 | AlexaInterface.cpp \ 53 | ObserverManager.cpp \ 54 | BaseCard.cpp \ 55 | WeatherCard.cpp \ 56 | InfoCard.cpp \ 57 | SampleEqualizerModeController.cpp \ 58 | DialogStateManager.cpp \ 59 | CapabilitiesManager.cpp \ 60 | QtMicrophoneWrapper.cpp \ 61 | vehicleintentcard.cpp 62 | 63 | HEADERS += \ 64 | AuthManager.h \ 65 | ConnectionManager.h \ 66 | alexainterface_plugin.h \ 67 | InteractionManager.h \ 68 | KeywordObserver.h \ 69 | GuiRenderer.h \ 70 | AlexaInterface.h \ 71 | ObserverManager.h \ 72 | BaseCard.h \ 73 | WeatherCard.h \ 74 | InfoCard.h \ 75 | SampleEqualizerModeController.h \ 76 | DialogStateManager.h \ 77 | CapabilitiesManager.h \ 78 | QtMicrophoneWrapper.h \ 79 | vehicleintentcard.h 80 | 81 | DISTFILES = qmldir 82 | 83 | 84 | qmldir.files = qmldir 85 | 86 | unix { 87 | DEFINES += GSTREAMER_MEDIA_PLAYER 88 | 89 | installPath = $$INSTALL_PREFIX/apps/com.luxoft.alexa/imports/alexainterface 90 | qmldir.path = $$installPath 91 | target.path = $$installPath 92 | 93 | kwd.files += ./../../kwd/alexa.umdl \ 94 | ./../../kwd/common.res 95 | 96 | kwd.path = $$INSTALL_PREFIX/apps/com.luxoft.alexa/kwd 97 | 98 | INSTALLS += target qmldir kwd 99 | } 100 | 101 | printLine() 102 | -------------------------------------------------------------------------------- /plugins/alexainterface/DialogStateManager.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #ifndef ALEXAINTERFACE_DIALOGSTATEMANAGER_H 33 | #define ALEXAINTERFACE_DIALOGSTATEMANAGER_H 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | /** 40 | * This class manages the dialog states that the user will see when interacting with the Alexa Interface. 41 | */ 42 | 43 | using namespace alexaClientSDK; 44 | 45 | class DialogStateManager 46 | : public QObject 47 | , public avsCommon::sdkInterfaces::DialogUXStateObserverInterface 48 | { 49 | Q_OBJECT 50 | public: 51 | 52 | enum DialogState { 53 | Idle, 54 | Listening, 55 | Thinking, 56 | Speaking, 57 | Finished 58 | }; 59 | Q_ENUM(DialogState) 60 | 61 | explicit DialogStateManager(QObject* parent = nullptr); 62 | DialogState dialogState() const { return m_dialogState; } 63 | void onDialogUXStateChanged(DialogUXState state) override; 64 | 65 | Q_SIGNALS: 66 | void dialogStateChanged(); 67 | 68 | private: 69 | DialogState m_dialogState = DialogState::Idle; 70 | 71 | /// An internal executor that performs execution of callable objects passed to it sequentially but asynchronously. 72 | avsCommon::utils::threading::Executor m_executor; 73 | }; 74 | 75 | #endif // ALEXAINTERFACE_DIALOGSTATEMANAGER_H 76 | -------------------------------------------------------------------------------- /plugins/alexainterface/myfeatures.prf: -------------------------------------------------------------------------------- 1 | 2 | defineReplace(yesNo) { 3 | if ($$1):return("yes") 4 | else:return("no") 5 | } 6 | 7 | defineTest(printLine) { 8 | !build_pass:return 9 | 10 | msg="$$1" 11 | val=$$2 12 | color=$$3 13 | width=$$4 14 | 15 | isEmpty(width):width = 30 16 | 17 | unix:system("test -t 2") { # check if we are on unix and stderr is a tty 18 | macos:echo="echo" 19 | else:echo="/bin/echo -e" 20 | 21 | equals(color, "auto") { 22 | yesmatch = $$find(val, "^yes") 23 | nomatch = $$find(val, "^no") 24 | automatch = $$find(val, "^auto") 25 | 26 | !isEmpty(yesmatch):color = "green" 27 | else:!isEmpty(nomatch):color = "red" 28 | else:!isEmpty(automatch):color = "yellow" 29 | } 30 | equals(color, "red"): prolog=$$system($$echo "\\\\033")[31;1m 31 | else:equals(color, "green"): prolog=$$system($$echo "\\\\033")[32;1m 32 | else:equals(color, "yellow"): prolog=$$system($$echo "\\\\033")[33;1m 33 | else:equals(color, "orange"): prolog=$$system($$echo "\\\\033")[33m 34 | else:equals(color, "white"): prolog=$$system($$echo "\\\\033")[37;1m 35 | epilog = $$system($$echo "\\\\033")[0m 36 | } 37 | 38 | isEmpty(msg)|contains(msg, "^-- .*") { 39 | log($$prolog$$section(msg, "-- ", 1, -1)$$epilog$$escape_expand(\\n)) 40 | return() 41 | } 42 | 43 | # The tricky part: there are no arithmetic functions in qmake! 44 | # Start by createing an array of strings, where the string at [i] consists of i dots 45 | # We need it the other way around though, hence the reverse at the end (sadly you 46 | # cannot run a $$width..1 loop, although 30..1 does work). 47 | for(i, 1..$$width) { 48 | spacingEntry="" 49 | for (j, 1..$$i) { spacingEntry += "." } 50 | spacing += $$join(spacingEntry) 51 | } 52 | spacing = $$reverse(spacing) 53 | 54 | # convert a string into an array of characters, so we can get the length via size() 55 | msgArray = $$split(msg,) 56 | 57 | log(" $$msg $$member(spacing, $$size(msgArray)) $$prolog$$val$$epilog$$escape_expand(\\n)") 58 | } 59 | 60 | defineTest(testDir) { 61 | msg=$$1 62 | val=$$2 63 | 64 | res="Not found" 65 | exists( $$val ) { 66 | res = $$val 67 | printLine($$msg, $$res, green) 68 | return(true) 69 | } else { 70 | printLine($$msg, "Not found", red) 71 | return(false) 72 | } 73 | } 74 | 75 | defineTest(testLib) { 76 | path=$$1 77 | lib=$$2 78 | 79 | libFile = "lib"$$lib".so" 80 | res="Not found" 81 | exists( $$path"/"$$libFile ) { 82 | res = "Found" 83 | printLine($$libFile, $$res, green) 84 | return(true) 85 | } else { 86 | printLine($$libFile, $$res, red) 87 | return(false) 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /app/BasicCard.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | import QtQuick 2.10 33 | import QtQuick.Controls 2.3 34 | 35 | import shared.Sizes 1.0 36 | 37 | Control { 38 | id: root 39 | 40 | property var cardData 41 | 42 | //default property alias cardContent: root.contentItem 43 | signal closeClicked() 44 | property bool closeEnabled: true 45 | 46 | Item { 47 | id: closeButton 48 | z: 10 49 | anchors.top: parent.top 50 | anchors.topMargin: Sizes.dp(15) 51 | anchors.right: parent.right 52 | anchors.rightMargin: Sizes.dp(15) 53 | width: Sizes.dp(64) 54 | height: Sizes.dp(64) 55 | visible: root.closeEnabled 56 | Rectangle { 57 | anchors.fill: parent 58 | radius: width/2 59 | color: "lightgrey" 60 | opacity: maCloseButton.containsMouse ? 0.8 : 0 61 | Behavior on opacity { NumberAnimation { duration: 200 } } 62 | scale: maCloseButton.containsPress ? 0.95 : 1 63 | Behavior on scale { NumberAnimation { duration: 100 } } 64 | } 65 | Label { 66 | anchors.centerIn: parent 67 | font.pixelSize: Sizes.fontSizeXXL 68 | opacity: maCloseButton.containsMouse ? 0.8 : 0.3 69 | Behavior on opacity { NumberAnimation { duration: 200 } } 70 | scale: maCloseButton.containsPress ? 0.95 : 1 71 | Behavior on scale { NumberAnimation { duration: 100 } } 72 | text: "\u2715" 73 | } 74 | MouseArea { 75 | id: maCloseButton 76 | anchors.fill: parent 77 | hoverEnabled: true 78 | onClicked: root.closeClicked() 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /plugins/alexainterface/InfoCard.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #ifndef INFOCARD_H 33 | #define INFOCARD_H 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include "BaseCard.h" 40 | 41 | class InfoCard : public BaseCard 42 | { 43 | Q_OBJECT 44 | 45 | Q_PROPERTY(QString subtitle READ subtitle NOTIFY subtitleChanged) 46 | Q_PROPERTY(QString title READ title NOTIFY titleChanged) 47 | Q_PROPERTY(QString skillIcon READ skillIcon NOTIFY skillIconChanged) 48 | Q_PROPERTY(QString text READ text NOTIFY textChanged) 49 | Q_PROPERTY(QString image READ image NOTIFY imageChanged) 50 | 51 | public: 52 | 53 | explicit InfoCard(QObject *parent = nullptr); 54 | virtual ~InfoCard() override = default; 55 | 56 | QString subtitle() const { return m_subtitle; } 57 | QString title() const { return m_title; } 58 | QString skillIcon() const { return m_skillIcon; } 59 | QString text() const { return m_text; } 60 | QString image() const { return m_image; } 61 | 62 | virtual void setJsonDocument(QJsonDocument jsonDocument) override; 63 | 64 | void setTitle(const QString &title); 65 | void setSubtitle(const QString &subtitle); 66 | void setText(const QString &text); 67 | void setImage(const QString &image); 68 | void setSkillIcon(const QString &skillIcon); 69 | Q_SIGNALS: 70 | void subtitleChanged(QString subtitle); 71 | void titleChanged(QString title); 72 | void skillIconChanged(QString skillIcon); 73 | void textChanged(QString text); 74 | void imageChanged(QString image); 75 | 76 | private: 77 | QString m_subtitle; 78 | QString m_title; 79 | QString m_skillIcon; 80 | QString m_text; 81 | QString m_image; 82 | }; 83 | 84 | #endif //INFOCARD_H 85 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Alexa voice client for Neptune3. 3 | 4 | *** Compile the package *** 5 | 6 | Compile the package com.luxoft.alexa.pkg by running 'qmake; make package'. More details about packages are explained on 7 | https://doc.qt.io/QtApplicationManager/appman-packager.html and https://doc.qt.io/archives/QtApplicationManager/package-format.html 8 | 9 | In an ideal case compilation is not needed, but due to several libraries and dependencies, version numbers might differ. 10 | The current package in the repository is compiled using Qt 5.13. 11 | 12 | 13 | *** Download and run in Neptune3 *** 14 | 15 | The compiled com.luxoft.alexa.pkg has to be loaded from a local directory to Neptune3. 16 | It can be done for example by adding a path to com.luxoft.alexa in Neptune3 Download Center. 17 | The package is not available on the server with other Neptune3 applications Spotify, Netflix, ... 18 | 19 | 20 | *** Alexa authorization *** 21 | 22 | Create Amazon developer account on https://developer.amazon.com/ if you don't have one. 23 | When launching Alexa application first time, the application has to be authorized. 24 | 25 | For automatic authorization is needed QtWebEngine and Qt Application Manager compiled with 26 | widgets support '-config enable-widgets'. By default Qt Application Manager is compiled without widgets support 27 | and that's why AlexaAuth plugin assumes widgets are not supported. 28 | 29 | In case automatic authorization is not used, the application opens a web view for manual authorization. Input your email, 30 | password and authorization code which the application shows. 31 | 32 | Steps for the automatic authorization: 33 | 1) Compile Qt Application manager with widgets support 'qmake -config enable-widgets' 34 | 2) In com.luxoft.alexa/plugins/AlexaAuth/alexaauth.pro change QAPPMAN_ENABLES_WIDGETS to true. 35 | 3) Compile Alexa application 'qmake; make package' 36 | 4) Install Alexa application to Neptune3. Make sure to remove previous version of the application. 37 | 38 | 39 | *** Alexa usage *** 40 | 41 | Alexa can be called by pressing the microphone button. 42 | 43 | By default wake up word 'Alexa' is disabled because it requires GLIBC 2.27. 44 | The wake up word can be enabled in com.luxoft.alexa/plugins/alexainterface/alexainterface.pro by setting 45 | USE_WAKEUP_WORD to 1 and recompiling the application. 46 | 47 | The application supports display cards for weather and general knowledge. 48 | Those can be tested by saying for example: "Alexa, what is the weather in Stockholm" or "Alexa, tell me about Sweden" 49 | 50 | The application can be added as a widget in Neptune3. 51 | 52 | 53 | *** Alexa Client SDK *** 54 | 55 | Download and compile PortAudio http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz 56 | with "./congigure --without-jack" 57 | 58 | If you want to use Wake Up word, download Kitt-AI Snowboy https://github.com/Kitt-AI/snowboy/ 59 | 60 | Clone and compile Alexa Client SDK with cmake. git://github.com/alexa/avs-device-sdk.git 61 | 1.12 version is required. Commit hash is ea3ebdb6e75e04ad59d260607aea209c17423682 62 | 63 | Please refer to https://github.com/alexa/avs-device-sdk/wiki/Ubuntu-Linux-Quick-Start-Guide for linux 64 | build instructions 65 | 66 | 67 | *** Future development *** 68 | 69 | - Support for Mac and Windows 70 | - For custom skills is needed an AWS account. 71 | 72 | 73 | -------------------------------------------------------------------------------- /plugins/alexainterface/ObserverManager.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #include 33 | #include 34 | 35 | #include 36 | 37 | #include "ObserverManager.h" 38 | 39 | #include 40 | 41 | using namespace alexaClientSDK::avsCommon::sdkInterfaces; 42 | 43 | ObserverManager::ObserverManager(QObject *parent) : QObject (parent) 44 | { 45 | } 46 | 47 | void ObserverManager::onSettingChanged(const std::string& key, const std::string& value) { 48 | m_executor.submit([key, value]() { 49 | std::string msg = key + " set to " + value; 50 | qDebug("SETTINGS: %s set to %s", key.c_str(), value.c_str()); 51 | //TODO: Add a signal here 52 | //TODO: should be move in a separate class 53 | }); 54 | } 55 | 56 | void ObserverManager::onSpeakerSettingsChanged( const SpeakerManagerObserverInterface::Source& source, 57 | const SpeakerInterface::Type& type, 58 | const SpeakerInterface::SpeakerSettings& settings) { 59 | m_executor.submit([source, type, settings]() { 60 | std::ostringstream oss; 61 | oss << "SOURCE:" << source << " TYPE:" << type << " VOLUME:" << static_cast(settings.volume) << " MUTE:" << settings.mute; 62 | qDebug() << oss.str().c_str(); 63 | //TODO: Add a signal here 64 | //TODO: should be move in a separate class 65 | }); 66 | } 67 | 68 | void ObserverManager::onSetIndicator(avsCommon::avs::IndicatorState state) { 69 | m_executor.submit([state]() { 70 | qDebug("Notification indicator state: %d", state); 71 | //TODO: Emit a signal if this state is needed 72 | }); 73 | } 74 | 75 | //TODO: Would be good to split this into many different classes which inherit every single interface from the SDK 76 | //or at least two or three with similar meanings but not a bunch of those in the same class as it was done in the Alexa Interface 77 | -------------------------------------------------------------------------------- /plugins/alexainterface/KeywordObserver.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #include "KeywordObserver.h" 33 | 34 | using namespace alexaClientSDK; 35 | 36 | KeywordObserver::KeywordObserver( 37 | QObject* parent, 38 | std::shared_ptr client, 39 | capabilityAgents::aip::AudioProvider audioProvider, 40 | std::shared_ptr espProvider) : 41 | QObject(parent), 42 | m_client{client}, 43 | m_audioProvider{audioProvider}, 44 | m_espProvider{espProvider} { 45 | } 46 | 47 | void KeywordObserver::onKeyWordDetected( 48 | std::shared_ptr stream, 49 | std::string keyword, 50 | avsCommon::avs::AudioInputStream::Index beginIndex, 51 | avsCommon::avs::AudioInputStream::Index endIndex, 52 | std::shared_ptr> KWDMetadata) { 53 | 54 | Q_UNUSED(stream) 55 | 56 | if (endIndex != avsCommon::sdkInterfaces::KeyWordObserverInterface::UNSPECIFIED_INDEX && 57 | beginIndex == avsCommon::sdkInterfaces::KeyWordObserverInterface::UNSPECIFIED_INDEX) { 58 | if (m_client) { 59 | m_client->notifyOfTapToTalk(m_audioProvider, endIndex); 60 | Q_EMIT tapToTalkDetected(); 61 | } 62 | } else if ( 63 | endIndex != avsCommon::sdkInterfaces::KeyWordObserverInterface::UNSPECIFIED_INDEX && 64 | beginIndex != avsCommon::sdkInterfaces::KeyWordObserverInterface::UNSPECIFIED_INDEX) { 65 | auto espData = capabilityAgents::aip::ESPData::getEmptyESPData(); 66 | if (m_espProvider) { 67 | espData = m_espProvider->getESPData(); 68 | } 69 | 70 | if (m_client) { 71 | auto startOfSpeechTimestamp = std::chrono::steady_clock::now(); 72 | m_client->notifyOfWakeWord(m_audioProvider, beginIndex, endIndex, keyword, startOfSpeechTimestamp, espData, KWDMetadata); 73 | Q_EMIT keyWordDetected(); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/main.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | import application.windows 1.0 33 | 34 | import QtQuick 2.10 35 | import QtQuick.Window 2.10 36 | import QtQuick.Controls 2.5 37 | 38 | import shared.Sizes 1.0 39 | import shared.Style 1.0 40 | 41 | ApplicationCCWindow { 42 | id: root 43 | 44 | Image { 45 | id: headerImage 46 | x: root.exposedRect.x 47 | y: 0 48 | width: root.exposedRect.width 49 | height: Sizes.dp(436) + exposedRect.y 50 | fillMode: Image.Pad 51 | 52 | source: "assets/alexa_background.png" 53 | asynchronous: true 54 | opacity: root.neptuneState === "Maximized" ? 1 : 0 55 | visible: opacity > 0 56 | } 57 | 58 | Label { 59 | id: alexaLoadErrorText 60 | anchors.verticalCenter: parent.verticalCenter 61 | font.pixelSize: Sizes.fontSizeM 62 | font.weight: Font.Medium 63 | horizontalAlignment: Text.AlignHCenter 64 | width: root.exposedRect.width 65 | opacity: Style.opacityHigh 66 | text: qsTr("Please make sure that the Alexa SDK is installed correctly") 67 | visible: false 68 | } 69 | 70 | Loader { 71 | source: "MainView.qml" 72 | onStatusChanged: { 73 | if (status === Loader.Error) { 74 | alexaLoadErrorText.visible = true 75 | } 76 | } 77 | onLoaded: { 78 | alexaLoadErrorText.visible = false 79 | item.x = Qt.binding(function() { return root.exposedRect.x; }) 80 | item.y = Qt.binding(function() { return root.exposedRect.y; }) 81 | item.width = Qt.binding(function() { return root.exposedRect.width; }) 82 | item.height = Qt.binding(function() { return root.exposedRect.height; }) 83 | item.neptuneState = Qt.binding(function() { return root.neptuneState; }) 84 | item.visible = Qt.binding(function() { return root.exposedRect.height > 0; }) 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /plugins/alexainterface/CapabilitiesManager.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #include "CapabilitiesManager.h" 33 | 34 | CapabilitiesManager::CapabilitiesManager(QObject* parent) : QObject(parent) 35 | { 36 | } 37 | 38 | void CapabilitiesManager::onCapabilitiesStateChange( 39 | CapabilitiesObserverInterface::State newState, 40 | CapabilitiesObserverInterface::Error newError) { 41 | m_executor.submit([this, newState, newError]() { 42 | 43 | CapabilitiesError error = CapabilitiesError::Uninitialized; 44 | 45 | if (newError == CapabilitiesObserverInterface::Error::SUCCESS) { 46 | error = CapabilitiesError::Success; 47 | } else if (newError == CapabilitiesObserverInterface::Error::UNKNOWN_ERROR) { 48 | error = CapabilitiesError::UnknownError; 49 | } else if (newError == CapabilitiesObserverInterface::Error::FORBIDDEN) { 50 | error = CapabilitiesError::Forbidden; 51 | } else if (newError == CapabilitiesObserverInterface::Error::SERVER_INTERNAL_ERROR) { 52 | error = CapabilitiesError::ServerInternalError; 53 | } else if (newError == CapabilitiesObserverInterface::Error::BAD_REQUEST) { 54 | error = CapabilitiesError::BadRequest; 55 | } 56 | 57 | if (m_capabilitiesError != error) { 58 | m_capabilitiesError = error; 59 | Q_EMIT capabilitiesErrorChanged(); 60 | } 61 | 62 | CapabilitiesState state = CapabilitiesState::Uninitialized; 63 | 64 | if (newState == CapabilitiesObserverInterface::State::FATAL_ERROR) { 65 | state = CapabilitiesState::FatalError; 66 | } else if (newState == CapabilitiesObserverInterface::State::RETRIABLE_ERROR) { 67 | state = CapabilitiesState::RetriableError; 68 | } else if (newState == CapabilitiesObserverInterface::State::SUCCESS) { 69 | state = CapabilitiesState::Success; 70 | } 71 | 72 | if (m_capabilitiesState != state) { 73 | m_capabilitiesState = state; 74 | Q_EMIT capabilitiesStateChanged(); 75 | } 76 | }); 77 | } 78 | -------------------------------------------------------------------------------- /plugins/alexainterface/ObserverManager.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #ifndef ALEXAINTERFACE_OBSERVERMANAGER_H 33 | #define ALEXAINTERFACE_OBSERVERMANAGER_H 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #include 43 | 44 | /** 45 | * This class manages the states that the user will see when interacting with the Alexa Interface. For now, it simply 46 | * prints states to the screen. 47 | */ 48 | 49 | using namespace alexaClientSDK; 50 | 51 | class ObserverManager 52 | : public QObject 53 | , public avsCommon::sdkInterfaces::SingleSettingObserverInterface 54 | , public avsCommon::sdkInterfaces::SpeakerManagerObserverInterface 55 | , public avsCommon::sdkInterfaces::NotificationsObserverInterface { 56 | Q_OBJECT 57 | 58 | public: 59 | /** 60 | * Constructor. 61 | */ 62 | explicit ObserverManager(QObject* parent = nullptr); 63 | 64 | void onSettingChanged(const std::string& key, const std::string& value) override; 65 | 66 | /// @name SpeakerManagerObserverInterface Functions 67 | /// @{ 68 | void onSpeakerSettingsChanged( 69 | const avsCommon::sdkInterfaces::SpeakerManagerObserverInterface::Source& source, 70 | const avsCommon::sdkInterfaces::SpeakerInterface::Type& type, 71 | const avsCommon::sdkInterfaces::SpeakerInterface::SpeakerSettings& settings) override; 72 | /// } 73 | 74 | /// @name NotificationsObserverInterface Functions 75 | /// @{ 76 | void onSetIndicator(avsCommon::avs::IndicatorState state) override; 77 | /// } 78 | 79 | private: 80 | 81 | /// An internal executor that performs execution of callable objects passed to it sequentially but asynchronously. 82 | avsCommon::utils::threading::Executor m_executor; 83 | }; 84 | 85 | 86 | #endif // ALEXAINTERFACE_OBSERVERMANAGER_H 87 | -------------------------------------------------------------------------------- /plugins/alexainterface/KeywordObserver.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #ifndef VW_KEYWORDOBSERVER_H_ 33 | #define VW_KEYWORDOBSERVER_H_ 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | 45 | using namespace alexaClientSDK; 46 | 47 | /** 48 | * Observes callbacks from keyword detections and notifies the DefaultClient that a wake word has occurred. 49 | */ 50 | class KeywordObserver 51 | : public QObject 52 | , public avsCommon::sdkInterfaces::KeyWordObserverInterface { 53 | Q_OBJECT 54 | public: 55 | /** 56 | * Constructor. 57 | * 58 | * @param client The default SDK client. 59 | * @param audioProvider The audio provider from which to stream audio data from. 60 | * @parm espProvider The ESP provider to calculate the Ambient and Voice energy from the audio stream. 61 | */ 62 | explicit KeywordObserver( 63 | QObject* parent, 64 | std::shared_ptr client, 65 | capabilityAgents::aip::AudioProvider audioProvider, 66 | std::shared_ptr espProvider = nullptr); 67 | 68 | /// @name KeyWordObserverInterface Functions 69 | /// @{ 70 | void onKeyWordDetected( 71 | std::shared_ptr stream, 72 | std::string keyword, 73 | avsCommon::avs::AudioInputStream::Index beginIndex = UNSPECIFIED_INDEX, 74 | avsCommon::avs::AudioInputStream::Index endIndex = UNSPECIFIED_INDEX, 75 | std::shared_ptr> KWDMetadata = nullptr) override; 76 | /// @} 77 | 78 | Q_SIGNALS: 79 | void keyWordDetected(); 80 | void tapToTalkDetected(); 81 | 82 | private: 83 | /// The default SDK client. 84 | std::shared_ptr m_client; 85 | 86 | /// The audio provider. 87 | capabilityAgents::aip::AudioProvider m_audioProvider; 88 | 89 | /// Echo Spatial Perception (ESP) provider. 90 | std::shared_ptr m_espProvider; 91 | }; 92 | 93 | 94 | #endif // VW_KEYWORDOBSERVER_H_ 95 | -------------------------------------------------------------------------------- /plugins/alexainterface/CapabilitiesManager.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #ifndef ALEXAINTERFACE_CAPABILITIESMANAGER_H 33 | #define ALEXAINTERFACE_CAPABILITIESMANAGER_H 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | /** 40 | * This class is used to observe changes to the state of the CapabilitiesDelegate. 41 | */ 42 | 43 | using namespace alexaClientSDK; 44 | 45 | class CapabilitiesManager 46 | : public QObject 47 | , public avsCommon::sdkInterfaces::CapabilitiesObserverInterface 48 | { 49 | Q_OBJECT 50 | 51 | Q_PROPERTY(CapabilitiesState capabilitiesState READ capabilitiesState NOTIFY capabilitiesStateChanged) 52 | Q_PROPERTY(CapabilitiesError capabilitiesError READ capabilitiesError NOTIFY capabilitiesErrorChanged) 53 | 54 | public: 55 | enum class CapabilitiesState { 56 | Uninitialized, 57 | Success, 58 | FatalError, 59 | RetriableError 60 | }; 61 | Q_ENUM(CapabilitiesState) 62 | 63 | enum class CapabilitiesError { 64 | Uninitialized, 65 | Success, 66 | UnknownError, 67 | Forbidden, 68 | ServerInternalError, 69 | BadRequest 70 | }; 71 | Q_ENUM(CapabilitiesError) 72 | 73 | explicit CapabilitiesManager(QObject* parent = nullptr); 74 | 75 | CapabilitiesState capabilitiesState() const { return m_capabilitiesState; } 76 | CapabilitiesError capabilitiesError() const { return m_capabilitiesError; } 77 | 78 | /// @name CapabilitiesObserverInterface Methods 79 | /// @{ 80 | void onCapabilitiesStateChange( 81 | avsCommon::sdkInterfaces::CapabilitiesObserverInterface::State newState, 82 | avsCommon::sdkInterfaces::CapabilitiesObserverInterface::Error newError) override; 83 | /// } 84 | 85 | Q_SIGNALS: 86 | void capabilitiesStateChanged(); 87 | void capabilitiesErrorChanged(); 88 | 89 | private: 90 | CapabilitiesState m_capabilitiesState = CapabilitiesState::Uninitialized; 91 | CapabilitiesError m_capabilitiesError = CapabilitiesError::Uninitialized; 92 | 93 | /// An internal executor that performs execution of callable objects passed to it sequentially but asynchronously. 94 | avsCommon::utils::threading::Executor m_executor; 95 | 96 | }; 97 | 98 | #endif // ALEXAINTERFACE_CAPABILITIESMANAGER_H 99 | -------------------------------------------------------------------------------- /plugins/alexainterface/WeatherCard.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #ifndef WEATHERCARD_H 33 | #define WEATHERCARD_H 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include "BaseCard.h" 40 | 41 | class WeatherCard : public BaseCard 42 | { 43 | Q_OBJECT 44 | 45 | Q_PROPERTY(qreal temperature READ temperature NOTIFY temperatureChanged) 46 | Q_PROPERTY(qreal lowTemperature READ lowTemperature NOTIFY lowTemperatureChanged) 47 | Q_PROPERTY(qreal highTemperature READ highTemperature NOTIFY highTemperatureChanged) 48 | Q_PROPERTY(QString subtitle READ subtitle NOTIFY subtitleChanged) 49 | Q_PROPERTY(QString title READ title NOTIFY titleChanged) 50 | Q_PROPERTY(QString description READ description NOTIFY descriptionChanged) 51 | Q_PROPERTY(QString weatherIcon READ weatherIcon NOTIFY weatherIconChanged) 52 | 53 | public: 54 | explicit WeatherCard(QObject *parent = nullptr); 55 | 56 | qreal temperature() const { return m_temperature; } 57 | qreal lowTemperature() const { return m_lowTemperature; } 58 | qreal highTemperature() const { return m_highTemperature; } 59 | QString subtitle() const { return m_subtitle; } 60 | QString title() const { return m_title; } 61 | QString description() const { return m_description; } 62 | QString weatherIcon() const { return m_weatherIcon; } 63 | 64 | void setJsonDocument(QJsonDocument jsonDocument) override; 65 | 66 | Q_SIGNALS: 67 | void temperatureChanged(qreal temperature); 68 | void lowTemperatureChanged(qreal lowestTemperature); 69 | void highTemperatureChanged(qreal highestTemperature); 70 | void titleChanged(QString title); 71 | void subtitleChanged(QString subtitle); 72 | void descriptionChanged(QString description); 73 | void weatherIconChanged(QString weatherIcon); 74 | 75 | public Q_SLOTS: 76 | 77 | private: 78 | void setTemperature(qreal temperature); 79 | void setLowTemperature(qreal lowTemperature); 80 | void setHighTemperature(qreal highTemperature); 81 | void setSubtitle(QString subtitle); 82 | void setTitle(QString title); 83 | void setDescription(QString description); 84 | void setWeatherIcon(QString icon); 85 | 86 | qreal m_temperature; 87 | qreal m_lowTemperature; 88 | qreal m_highTemperature; 89 | QString m_subtitle; 90 | QString m_title; 91 | QString m_description; 92 | QString m_weatherIcon; 93 | }; 94 | 95 | #endif // WEATHERCARD_H 96 | -------------------------------------------------------------------------------- /app/InfoCard.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | import QtQuick 2.12 33 | import QtQuick.Controls 2.5 34 | import QtQuick.Layouts 1.12 35 | 36 | import shared.Sizes 1.0 37 | 38 | BasicCard { 39 | id: root 40 | 41 | Column { 42 | id: titleContent 43 | anchors.top: parent.top 44 | anchors.topMargin: Sizes.dp(10) 45 | anchors.left: parent.left 46 | anchors.leftMargin: Sizes.dp(50) 47 | anchors.right: parent.right 48 | anchors.rightMargin: Sizes.dp(50) 49 | spacing: Sizes.dp(7) 50 | Label { 51 | width: parent.width 52 | font.pixelSize: Sizes.fontSizeL 53 | elide: Text.ElideRight 54 | wrapMode: Text.WrapAtWordBoundaryOrAnywhere 55 | text: cardData.title 56 | } 57 | Label { 58 | width: parent.width 59 | font.pixelSize: Sizes.fontSizeM 60 | elide: Text.ElideRight 61 | wrapMode: Text.WrapAtWordBoundaryOrAnywhere 62 | text: cardData.subtitle 63 | opacity: 0.7 64 | } 65 | } 66 | 67 | Flickable { 68 | id: flickable 69 | anchors.top: titleContent.bottom 70 | anchors.topMargin: Sizes.dp(20) 71 | anchors.bottom: parent.bottom 72 | anchors.bottomMargin: Sizes.dp(20) 73 | anchors.left: parent.left 74 | anchors.leftMargin: Sizes.dp(50) 75 | anchors.right: parent.right 76 | anchors.rightMargin: Sizes.dp(50) 77 | flickableDirection: Flickable.VerticalFlick 78 | contentHeight: infoContent.height 79 | contentWidth: infoContent.width 80 | clip: true 81 | 82 | ColumnLayout { 83 | id: infoContent 84 | width: parent.width 85 | spacing: Sizes.dp(50) 86 | Image { 87 | fillMode: Image.PreserveAspectFit 88 | source: cardData.image 89 | visible: cardData.image !== "" 90 | sourceSize.width: flickable.width 91 | } 92 | Label { 93 | Layout.preferredWidth: flickable.width 94 | wrapMode: Text.WordWrap 95 | font.pixelSize: Sizes.fontSizeL 96 | text: cardData.text 97 | visible: cardData.text !== "" 98 | } 99 | } 100 | ScrollIndicator.vertical: ScrollIndicator { 101 | } 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /plugins/alexainterface/GuiRenderer.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #ifndef ALEXAINTERFACE_GUIRENDERER_H 33 | #define ALEXAINTERFACE_GUIRENDERER_H 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | #include 40 | 41 | using namespace alexaClientSDK; 42 | 43 | /** 44 | * A class that implements the TemplateRuntimeObserverInterface. Instead of rendering the 45 | * display cards, this class will print out some useful information (e.g. JSON payload) 46 | * when the renderTemplateCard or renderPlayerInfoCard callbacks are called. 47 | * 48 | * It is also used to track the PlayerInfo controls, and provide the PlayerInfo toggle states. 49 | * 50 | * @note Due to the payload in RenderTemplate may contain sensitive information, the 51 | * payload will only be printed if @c ACSDK_EMIT_SENSITIVE_LOGS is ON. 52 | */ 53 | class GuiRenderer 54 | : public QObject 55 | , public avsCommon::sdkInterfaces::TemplateRuntimeObserverInterface { 56 | Q_OBJECT 57 | public: 58 | explicit GuiRenderer(QObject* parent = nullptr); 59 | 60 | /// @name TemplateRuntimeObserverInterface Functions 61 | /// @{ 62 | 63 | void renderTemplateCard(const std::string& jsonPayload, avsCommon::avs::FocusState focusState) override; 64 | void clearTemplateCard() override; 65 | 66 | void renderPlayerInfoCard(const std::string& jsonPayload, TemplateRuntimeObserverInterface::AudioPlayerInfo info, 67 | avsCommon::avs::FocusState focusState) override; 68 | void clearPlayerInfoCard() override; 69 | 70 | /// @} 71 | 72 | /// returns the PlayerInfo toggle state 73 | bool getGuiToggleState(const std::string& toggleName); 74 | 75 | /// String to identify the AVS action SELECTED string. 76 | static const std::string TOGGLE_ACTION_SELECTED; 77 | /// String to identify the AVS action DESELECTED string. 78 | static const std::string TOGGLE_ACTION_DESELECTED; 79 | /// String to identify the AVS name SHUFFLE string. 80 | static const std::string TOGGLE_NAME_SHUFFLE; 81 | /// String to identify the AVS name LOOP string. 82 | static const std::string TOGGLE_NAME_LOOP; 83 | /// String to identify the AVS name REPEAT string. 84 | static const std::string TOGGLE_NAME_REPEAT; 85 | /// String to identify the AVS name THUMBS_UP string. 86 | static const std::string TOGGLE_NAME_THUMBSUP; 87 | /// String to identify the AVS name THUMBS_DOWN string. 88 | static const std::string TOGGLE_NAME_THUMBSDOWN; 89 | 90 | private: 91 | // Last known toggle states 92 | std::map m_guiToggleStateMap; 93 | 94 | Q_SIGNALS: 95 | void templateCardContentReady(QString jsonString); 96 | void playerCardContentReady(QString jsonString); 97 | 98 | }; 99 | 100 | #endif // ALEXAINTERFACE_GUIRENDERER_H 101 | -------------------------------------------------------------------------------- /plugins/alexainterface/InfoCard.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #include "InfoCard.h" 33 | 34 | #include 35 | 36 | InfoCard::InfoCard(QObject *parent) : BaseCard(parent) 37 | { 38 | setType(BaseCard::Info); 39 | } 40 | 41 | void InfoCard::setSubtitle(const QString &subtitle) 42 | { 43 | if (m_subtitle == subtitle) 44 | return; 45 | m_subtitle = subtitle; 46 | Q_EMIT subtitleChanged(m_subtitle); 47 | } 48 | 49 | void InfoCard::setText(const QString &text) 50 | { 51 | if (m_text == text) 52 | return; 53 | m_text = text; 54 | Q_EMIT textChanged(m_text); 55 | } 56 | 57 | void InfoCard::setImage(const QString &image) 58 | { 59 | if (m_image == image) 60 | return; 61 | m_image = image; 62 | Q_EMIT imageChanged(m_image); 63 | } 64 | 65 | void InfoCard::setSkillIcon(const QString &skillIcon) 66 | { 67 | if (m_skillIcon == skillIcon) 68 | return; 69 | m_skillIcon = skillIcon; 70 | Q_EMIT skillIconChanged(m_skillIcon); 71 | } 72 | 73 | void InfoCard::setTitle(const QString &title) 74 | { 75 | if (m_title == title) 76 | return; 77 | m_title = title; 78 | Q_EMIT titleChanged(m_title); 79 | } 80 | 81 | void InfoCard::setJsonDocument(QJsonDocument jsonDocument) 82 | { 83 | QJsonObject obj = jsonDocument.object(); 84 | //qWarning() << jsonDocument.toJson(QJsonDocument::Indented); 85 | 86 | QString text = obj["textField"].toString(); 87 | setText(text); 88 | 89 | QJsonObject header = obj["title"].toObject(); 90 | QString title = header["mainTitle"].toString(); 91 | setTitle(title); 92 | 93 | QString subtitle = header["subTitle"].toString(); 94 | setSubtitle(subtitle); 95 | 96 | QJsonObject skillIcon = obj["skillIcon"].toObject(); 97 | QJsonArray skillIconSources = skillIcon["sources"].toArray(); 98 | QJsonObject sourceSmall = skillIconSources.at(0).toObject(); 99 | QString urlSkillIcon = sourceSmall["url"].toString(); 100 | setSkillIcon(urlSkillIcon); 101 | 102 | QString urlLargeImage, urlMediumImage, urlSmallImage; 103 | QJsonObject image = obj["image"].toObject(); 104 | QJsonArray sources = image["sources"].toArray(); 105 | for (auto jsVal : sources) { 106 | QString size = jsVal.toObject()["size"].toString().toLower(); 107 | if (size == "large") { 108 | urlLargeImage = jsVal.toObject()["url"].toString(); 109 | } else if (size == "medium") { 110 | urlMediumImage = jsVal.toObject()["url"].toString(); 111 | } else if (size == "small") { 112 | urlSmallImage = jsVal.toObject()["url"].toString(); 113 | } 114 | } 115 | if (!urlLargeImage.isEmpty()) { 116 | setImage(urlLargeImage); 117 | } else if (!urlMediumImage.isEmpty()) { 118 | setImage(urlMediumImage); 119 | } else if (!urlSmallImage.isEmpty()) { 120 | setImage(urlSmallImage); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /app/Header.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | import QtQuick 2.12 33 | import QtQuick.Controls 2.5 34 | 35 | import shared.Sizes 1.0 36 | import alexainterface 1.0 37 | 38 | Control { 39 | id: root 40 | 41 | QtObject { 42 | id: privateData 43 | readonly property var headerText: ['a', 'm', 'a', 'z', 'o', 'n', ' ', 'a', 'l', 'e', 'x', 'a'] 44 | property int headerTextIndex: 0 45 | } 46 | 47 | contentItem: Item { 48 | Row { 49 | id: animatedTextRow 50 | anchors.centerIn: parent 51 | anchors.verticalCenterOffset: Sizes.dp(50) 52 | spacing: Sizes.dp(35) 53 | Image { 54 | id: alexaLogo 55 | anchors.verticalCenter: parent.verticalCenter 56 | fillMode: Image.PreserveAspectFit 57 | height: root.height*0.25 58 | source: "assets/logo.png" 59 | } 60 | Label { 61 | id: alexaLogoText 62 | anchors.verticalCenter: parent.verticalCenter 63 | font.pixelSize: Sizes.fontSizeXXL 64 | font.letterSpacing: Sizes.dp(5) 65 | font.weight: Font.Medium 66 | opacity: 0.7 67 | } 68 | } 69 | Row { 70 | anchors.horizontalCenter: parent.horizontalCenter 71 | anchors.top: animatedTextRow.bottom 72 | anchors.topMargin: Sizes.dp(30) 73 | spacing: Sizes.dp(10) 74 | Rectangle { 75 | anchors.verticalCenter: parent.verticalCenter 76 | width: Sizes.dp(26) 77 | height: width 78 | radius: width/2 79 | color: AlexaInterface.connectionStatus === Alexa.Connected ? "#32CD32" : 80 | (AlexaInterface.connectionStatus === Alexa.Disconnected) ? 81 | "red" : "grey" 82 | } 83 | Label { 84 | anchors.verticalCenter: parent.verticalCenter 85 | font.pixelSize: Sizes.fontSizeS 86 | text: { 87 | if (AlexaInterface.connectionStatus === Alexa.Pending) 88 | return qsTr("Pending") 89 | else if (AlexaInterface.connectionStatus === Alexa.Connected) 90 | return qsTr("Connected") 91 | else return qsTr("Disconnected") 92 | } 93 | } 94 | } 95 | } 96 | 97 | Timer { 98 | id: timerTextAnimation 99 | interval: 80 100 | repeat: true 101 | onTriggered: { 102 | var letter = privateData.headerText[privateData.headerTextIndex] 103 | alexaLogoText.text += privateData.headerText[privateData.headerTextIndex] 104 | privateData.headerTextIndex += 1 105 | if (privateData.headerTextIndex === privateData.headerText.length) { 106 | timerTextAnimation.stop() 107 | } 108 | } 109 | } 110 | 111 | Component.onCompleted: { 112 | timerTextAnimation.start() 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /plugins/alexaauth/alexaauth.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 IVI UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #ifndef ALEXAAUTH_H 33 | #define ALEXAAUTH_H 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | 41 | // ## Step 1, login to amazon.developer.com 42 | #define HTML_TITLE_FIRST "Amazon Sign-In" 43 | #define HTML_IMPORTANT_MESSAGE "Important Message!" 44 | #define HTML_ENABLE_COOKIES "Please Enable Cookies to Continue" 45 | #define TAG_ALERT_HEADING_ID "a-alert-heading" 46 | #define TAG_EMAIL_ID "ap_email" 47 | #define TAG_PASSWORD_ID "ap_password" 48 | #define TAG_SIGN_IN_SUBMIT_ID "signInSubmit" 49 | #define TAG_CAPTCHA_IMAGE_ID "auth-captcha-image" 50 | #define TAG_CAPTCHA_GUESS_ID "auth-captcha-guess" 51 | 52 | // ## Step 2, give authorization code 53 | #define HTML_TITLE_SECOND "Amazon Two-Step Verification" 54 | #define HTML_TITLE_ERROR_CAPTCHA "There was a problem" 55 | #define TAG_REGISTRATION_FIELD_ID "cbl-registration-field" 56 | #define TAG_CONTINUE_BUTTON_ID "cbl-continue-button" 57 | 58 | // ## Step 3, success 59 | #define HTML_REGISTER_DEVICE "Register Your Device" 60 | #define HTML_SUCCESS "Success!" 61 | #define TAG_SUCCESS_TITLE_ID "cbl-page-title" 62 | 63 | class AlexaAuth : public QObject 64 | { 65 | Q_OBJECT 66 | 67 | public: 68 | enum ErrorState { 69 | NoError, 70 | WebEngineNotAvailable, 71 | ConfigFileFailure, 72 | HtmlItemNotFound, 73 | ImageRecognizionRequired, 74 | AutomaticAuthFailed 75 | }; 76 | Q_ENUM(ErrorState) 77 | 78 | enum AuthStage { 79 | AuthSignIn, 80 | AuthRegisterDevice, 81 | AuthError 82 | }; 83 | Q_ENUM(AuthStage) 84 | 85 | enum SignInResult { 86 | SignInInputEmail, 87 | SignInCaptcha, 88 | SignInError 89 | }; 90 | Q_ENUM(SignInResult) 91 | 92 | enum RegisterDeviceResult { 93 | RegisterDevice, 94 | RegisterDeviceSuccess, 95 | RegisterDeviceError 96 | }; 97 | Q_ENUM(RegisterDeviceResult) 98 | 99 | enum JSAuthString { 100 | SignIn, 101 | CaptchaSrc, 102 | GetCaptchaInput, 103 | SetCaptcha, 104 | GetEmailInput, 105 | SetEmail, 106 | GetPasswordInput, 107 | SetPassword, 108 | GetClickSignIn, 109 | RegisterDeviceTitle, 110 | GetInputCode, 111 | SetInputCode, 112 | GetContinue, 113 | ClickElement 114 | }; 115 | Q_ENUM(JSAuthString) 116 | 117 | explicit AlexaAuth(QObject *parent = nullptr); 118 | 119 | Q_INVOKABLE bool parseJson() const; 120 | Q_INVOKABLE AlexaAuth::AuthStage getAuthStage(const QString &title); 121 | Q_INVOKABLE QString getJSString(AlexaAuth::JSAuthString id, const QString &value = "") const; 122 | Q_INVOKABLE AlexaAuth::SignInResult signinToAmazonResult(const QVariant &cb); 123 | Q_INVOKABLE AlexaAuth::RegisterDeviceResult registerDeviceResult(const QVariant &cb); 124 | }; 125 | 126 | static QObject *alexaAuthSingletonProvider(QQmlEngine *engine, QJSEngine *scriptEngine) 127 | { 128 | Q_UNUSED(engine) 129 | Q_UNUSED(scriptEngine) 130 | 131 | AlexaAuth *singletonObject = new AlexaAuth(); 132 | return singletonObject; 133 | } 134 | 135 | #endif // ALEXAAUTH_H 136 | -------------------------------------------------------------------------------- /plugins/alexainterface/WeatherCard.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #include "WeatherCard.h" 33 | #include 34 | 35 | WeatherCard::WeatherCard(QObject *parent) : BaseCard(parent) 36 | { 37 | setType(BaseCard::Weather); 38 | } 39 | 40 | void WeatherCard::setTemperature(qreal temperature) 41 | { 42 | if (qFuzzyCompare(m_temperature, temperature)) 43 | return; 44 | m_temperature = temperature; 45 | Q_EMIT temperatureChanged(m_temperature); 46 | } 47 | 48 | void WeatherCard::setLowTemperature(qreal lowTemperature) 49 | { 50 | if (qFuzzyCompare(m_lowTemperature, lowTemperature)) 51 | return; 52 | m_lowTemperature = lowTemperature; 53 | Q_EMIT lowTemperatureChanged(m_lowTemperature); 54 | } 55 | 56 | void WeatherCard::setHighTemperature(qreal highTemperature) 57 | { 58 | if (qFuzzyCompare(m_highTemperature, highTemperature)) 59 | return; 60 | m_highTemperature = highTemperature; 61 | Q_EMIT highTemperatureChanged(m_highTemperature); 62 | } 63 | 64 | void WeatherCard::setSubtitle(QString date) 65 | { 66 | if (m_subtitle == date) 67 | return; 68 | m_subtitle = date; 69 | Q_EMIT subtitleChanged(m_subtitle); 70 | } 71 | 72 | void WeatherCard::setTitle(QString title) 73 | { 74 | if (m_title == title) 75 | return; 76 | m_title = title; 77 | Q_EMIT titleChanged(m_title); 78 | } 79 | 80 | void WeatherCard::setDescription(QString description) 81 | { 82 | if (m_description == description) 83 | return; 84 | 85 | m_description = description; 86 | Q_EMIT descriptionChanged(m_description); 87 | } 88 | 89 | void WeatherCard::setWeatherIcon(QString icon) { 90 | if (m_weatherIcon == icon) 91 | return; 92 | m_weatherIcon = icon; 93 | Q_EMIT weatherIconChanged(m_weatherIcon); 94 | } 95 | 96 | void WeatherCard::setJsonDocument(QJsonDocument jsonDocument) 97 | { 98 | QJsonObject obj = jsonDocument.object(); 99 | 100 | QString currentTemperature = obj["currentWeather"].toString(); 101 | currentTemperature.remove("°"); 102 | setTemperature(qreal(currentTemperature.toDouble())); 103 | 104 | QJsonObject lowTemperature = obj["lowTemperature"].toObject(); 105 | QString lowTemperatureValue = lowTemperature["value"].toString(); 106 | lowTemperatureValue.remove("°"); 107 | setLowTemperature(qreal(lowTemperatureValue.toDouble())); 108 | 109 | QJsonObject highTemperature = obj["highTemperature"].toObject(); 110 | QString highTemperatureValue = highTemperature["value"].toString(); 111 | highTemperatureValue.remove("°"); 112 | setHighTemperature(qreal(highTemperatureValue.toDouble())); 113 | 114 | QJsonObject title = obj["title"].toObject(); 115 | QString date = title["subTitle"].toString(); 116 | QString location = title["mainTitle"].toString(); 117 | setSubtitle(date); 118 | setTitle(location); 119 | 120 | QString forecastDescription = obj["description"].toString(); 121 | setDescription(forecastDescription); 122 | 123 | QJsonObject currentWeatherIcon = obj["currentWeatherIcon"].toObject(); 124 | QJsonArray sources = currentWeatherIcon["sources"].toArray(); 125 | QJsonObject sourcesMedium = sources.at(1).toObject(); 126 | QString url = sourcesMedium["url"].toString(); 127 | setWeatherIcon(url); 128 | 129 | } 130 | -------------------------------------------------------------------------------- /app/SettingsView.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | import QtQuick 2.0 33 | import QtQuick.Controls 2.3 34 | import QtQuick.Layouts 1.3 35 | 36 | import shared.Sizes 1.0 37 | import shared.Style 1.0 38 | import shared.controls 1.0 39 | import shared.utils 1.0 40 | 41 | import alexainterface 1.0 42 | 43 | 44 | Item { 45 | id: root 46 | 47 | signal resetAccountClicked() 48 | 49 | Flickable { 50 | anchors.fill: parent 51 | anchors.topMargin: Sizes.dp(80) 52 | anchors.bottomMargin: Sizes.dp(20) 53 | contentHeight: settingsLayout.height 54 | clip: true 55 | 56 | ScrollIndicator.vertical: ScrollIndicator { } 57 | 58 | ColumnLayout { 59 | id: settingsLayout 60 | 61 | spacing: Sizes.dp(40) 62 | width: parent.width 63 | 64 | ListItem { 65 | subText: "123456"; 66 | text: qsTr("Device serial number") 67 | Layout.fillWidth: true 68 | } 69 | 70 | ListItem { 71 | subText: "amzn1.application-oa2-client.a92e3edd0c8542a6bafcd89e5f125851"; 72 | text: qsTr("Alexa Client ID") 73 | Layout.fillWidth: true 74 | } 75 | 76 | ListItemSwitch { 77 | text: qsTr("Alexa wake word") 78 | switchOn: true 79 | enabled: false 80 | Layout.fillWidth: true 81 | } 82 | 83 | Button { 84 | visible: AlexaInterface.loggedIn 85 | implicitWidth: Sizes.dp(315) 86 | implicitHeight: Sizes.dp(64) 87 | font.pixelSize: Sizes.fontSizeS 88 | text: qsTr("Reset account") 89 | Layout.alignment: Qt.AlignHCenter 90 | enabled: false 91 | } 92 | 93 | ListItem { 94 | text: qsTr("Recording devices") 95 | Layout.fillWidth: true 96 | rightToolSymbol: "ic-update" 97 | onRightToolClicked: { 98 | //refresh model 99 | deviceListBind.value = AlexaInterface.deviceList 100 | } 101 | } 102 | 103 | 104 | ListView { 105 | id: listView 106 | height: childrenRect.height 107 | Layout.fillWidth: true 108 | interactive: false 109 | delegate: RadioButton { 110 | checked: AlexaInterface.deviceName === modelData 111 | width: parent.width 112 | height: Sizes.dp(50) 113 | font.pixelSize: Sizes.fontSizeXS 114 | indicator.implicitHeight: Sizes.dp(30) 115 | indicator.implicitWidth: Sizes.dp(30) 116 | text: modelData 117 | spacing: Sizes.dp(10) 118 | checkable: false 119 | onClicked: { 120 | AlexaInterface.deviceName = modelData 121 | } 122 | } 123 | 124 | Binding { 125 | id: deviceListBind 126 | target: listView 127 | property: "model" 128 | value: AlexaInterface.deviceList 129 | } 130 | } 131 | 132 | Item { 133 | Layout.fillHeight: true 134 | } 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /app/WeatherCard.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | import QtQuick 2.12 33 | import QtQuick.Controls 2.5 34 | import QtQuick.Layouts 1.12 35 | 36 | import shared.Sizes 1.0 37 | 38 | BasicCard { 39 | id: root 40 | 41 | Column { 42 | id: titleContent 43 | anchors.top: parent.top 44 | anchors.topMargin: Sizes.dp(10) 45 | anchors.left: parent.left 46 | anchors.leftMargin: Sizes.dp(50) 47 | anchors.right: parent.right 48 | anchors.rightMargin: Sizes.dp(50) 49 | spacing: Sizes.dp(7) 50 | Label { 51 | width: parent.width 52 | font.pixelSize: Sizes.fontSizeL 53 | elide: Text.ElideRight 54 | wrapMode: Text.WrapAtWordBoundaryOrAnywhere 55 | text: cardData.title 56 | } 57 | Label { 58 | width: parent.width 59 | font.pixelSize: Sizes.fontSizeM 60 | elide: Text.ElideRight 61 | wrapMode: Text.WrapAtWordBoundaryOrAnywhere 62 | text: cardData.subtitle 63 | opacity: 0.7 64 | } 65 | } 66 | 67 | RowLayout { 68 | id: temperatureRow 69 | anchors.top: titleContent.bottom 70 | anchors.topMargin: Sizes.dp(10) 71 | anchors.left: parent.left 72 | anchors.leftMargin: Sizes.dp(50) 73 | anchors.right: parent.right 74 | anchors.rightMargin: Sizes.dp(50) 75 | spacing: Sizes.dp(50) 76 | Image { 77 | Layout.preferredHeight: root.width/8 78 | Layout.preferredWidth: root.width/8 79 | fillMode: Image.PreserveAspectFit 80 | source: cardData.weatherIcon 81 | BusyIndicator { 82 | anchors.centerIn: parent 83 | visible: parent.state === Image.Loading 84 | } 85 | } 86 | Label { 87 | Layout.fillWidth: true 88 | font.pixelSize: root.width/5 89 | text: cardData.temperature + "\u00b0" 90 | opacity: 0.7 91 | } 92 | 93 | Column { 94 | Layout.preferredHeight: root.width/3 95 | Layout.preferredWidth: height 96 | Label { 97 | height: parent.height / 2 98 | width: parent.width 99 | horizontalAlignment: Text.AlignHCenter 100 | verticalAlignment: Text.AlignVCenter 101 | font.pixelSize: parent.height * 0.3 102 | text: "\u2191 " + cardData.highTemperature + "\u00b0" 103 | opacity: 0.5 104 | } 105 | Label { 106 | height: parent.height / 2 107 | width: parent.width 108 | horizontalAlignment: Text.AlignHCenter 109 | verticalAlignment: Text.AlignVCenter 110 | font.pixelSize: parent.height * 0.3 111 | text: "\u2193 " + cardData.lowTemperature + "\u00b0" 112 | opacity: 0.5 113 | } 114 | } 115 | } 116 | 117 | Label { 118 | anchors.top: temperatureRow.bottom 119 | anchors.topMargin: Sizes.dp(60) 120 | anchors.left: parent.left 121 | anchors.leftMargin: Sizes.dp(50) 122 | anchors.right: parent.right 123 | anchors.rightMargin: Sizes.dp(50) 124 | elide: Text.ElideRight 125 | wrapMode: Text.WrapAtWordBoundaryOrAnywhere 126 | text: cardData.description 127 | font.pixelSize: Sizes.fontSizeM 128 | opacity: 0.7 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /plugins/alexainterface/ConnectionManager.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #include "ConnectionManager.h" 33 | 34 | 35 | ConnectionManager::ConnectionManager(QObject* parent) : QObject (parent) 36 | { 37 | } 38 | 39 | void ConnectionManager::onConnectionStatusChanged(const ConnectionStatusObserverInterface::Status status, const ConnectionStatusObserverInterface::ChangedReason reason) { 40 | m_executor.submit([this, status, reason]() { 41 | 42 | ChangedReason r = this->fromAVSChangedReason(reason); 43 | if (r != m_changedReason) { 44 | m_changedReason = r; 45 | Q_EMIT changedReasonChanged(); 46 | } 47 | 48 | ConnectionStatus connectionStatus = m_connectionStatus; 49 | if (status == ConnectionStatusObserverInterface::Status::PENDING) { 50 | connectionStatus = ConnectionStatus::Pending; 51 | } else if (status == ConnectionStatusObserverInterface::Status::CONNECTED) { 52 | connectionStatus = ConnectionStatus::Connected; 53 | } else { 54 | connectionStatus = ConnectionStatus::Disconnected; 55 | } 56 | 57 | if (m_connectionStatus == connectionStatus) 58 | return; 59 | 60 | m_connectionStatus = connectionStatus; 61 | Q_EMIT connectionStatusChanged(); 62 | }); 63 | } 64 | 65 | ConnectionManager::ChangedReason ConnectionManager::fromAVSChangedReason( avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason reason ) const 66 | { 67 | switch (reason) { 68 | case ConnectionStatusObserverInterface::ChangedReason::SUCCESS: 69 | return ChangedReason::Success; 70 | case ConnectionStatusObserverInterface::ChangedReason::UNRECOVERABLE_ERROR: 71 | return ChangedReason::UnrecoverableError; 72 | case ConnectionStatusObserverInterface::ChangedReason::ACL_CLIENT_REQUEST: 73 | return ChangedReason::ACLClientRequest; 74 | case ConnectionStatusObserverInterface::ChangedReason::ACL_DISABLED: 75 | return ChangedReason::ACLDisabled; 76 | case ConnectionStatusObserverInterface::ChangedReason::DNS_TIMEDOUT: 77 | return ChangedReason::DNSTimeout; 78 | case ConnectionStatusObserverInterface::ChangedReason::CONNECTION_TIMEDOUT: 79 | return ChangedReason::ConnectionTimeout; 80 | case ConnectionStatusObserverInterface::ChangedReason::CONNECTION_THROTTLED: 81 | return ChangedReason::ConnectionThrottled; 82 | case ConnectionStatusObserverInterface::ChangedReason::INVALID_AUTH: 83 | return ChangedReason::InvalidAuth; 84 | case ConnectionStatusObserverInterface::ChangedReason::PING_TIMEDOUT: 85 | return ChangedReason::PingTimeout; 86 | case ConnectionStatusObserverInterface::ChangedReason::WRITE_TIMEDOUT: 87 | return ChangedReason::WriteTimeout; 88 | case ConnectionStatusObserverInterface::ChangedReason::READ_TIMEDOUT: 89 | return ChangedReason::ReadTimeout; 90 | case ConnectionStatusObserverInterface::ChangedReason::FAILURE_PROTOCOL_ERROR: 91 | return ChangedReason::FailureProtocolError; 92 | case ConnectionStatusObserverInterface::ChangedReason::INTERNAL_ERROR: 93 | return ChangedReason::InternalError; 94 | case ConnectionStatusObserverInterface::ChangedReason::SERVER_INTERNAL_ERROR: 95 | return ChangedReason::ServerInternalError; 96 | case ConnectionStatusObserverInterface::ChangedReason::SERVER_SIDE_DISCONNECT: 97 | return ChangedReason::ServerSideDisconnect; 98 | case ConnectionStatusObserverInterface::ChangedReason::SERVER_ENDPOINT_CHANGED: 99 | return ChangedReason::ServerEndpointChanged; 100 | default: 101 | return ChangedReason::None; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /plugins/alexainterface/PortAudioMicrophoneWrapper.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2019 Luxoft Sweden AB 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the Neptune 3 IVI UI. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-QTAS$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt Automotive Suite licenses may use 11 | ** this file in accordance with the commercial license agreement provided 12 | ** with the Software or, alternatively, in accordance with the terms 13 | ** contained in a written agreement between you and The Qt Company. For 14 | ** licensing terms and conditions see https://www.qt.io/terms-conditions. 15 | ** For further information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 or (at your option) any later version 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ** SPDX-License-Identifier: GPL-3.0 29 | ** 30 | ****************************************************************************/ 31 | 32 | #ifndef VW_PORTAUDIOMICROPHONEWRAPPER_H_ 33 | #define VW_PORTAUDIOMICROPHONEWRAPPER_H_ 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | 40 | #include 41 | #include