Use the new VehicleSignals API from libqtappfw to replace the
previous signal-composer usage.
Bug-AGL: SPEC-4409
Change-Id: Id5aaa6e9789f75a0aaecd4cfc560bbc4bae3f4c5
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
(cherry picked from commit
61e3d69532099d7215410c5b38e29ba3525dec46)
Component.onCompleted : {
// Let the mediaplayer backend know we're ready for metadata events
mediaplayer.start()
Component.onCompleted : {
// Let the mediaplayer backend know we're ready for metadata events
mediaplayer.start()
+
+ VehicleSignals.connect()
+ Connections {
+ target: VehicleSignals
+
+ onConnected: {
+ VehicleSignals.authorize()
+ }
+
+ onAuthorized: {
+ VehicleSignals.subscribe("Vehicle.Cabin.Infotainment.Media.Action")
+ }
+
+ onSignalNotification: {
+ if (path === "Vehicle.Cabin.Infotainment.Media.Action") {
+ if (value == "SkipForward") {
+ mediaplayer.next()
+ } else if (value == "SkipBackward") {
+ mediaplayer.previous()
+ } else if (value == "NextSource") {
+ if (player.av_connected)
+ mediaplayer.connect()
+ else
+ mediaplayer.disconnect()
+ }
+ }
+ }
+ }
+
Timer {
id: timer
interval: 250
Timer {
id: timer
interval: 250
QT = qml quickcontrols2
CONFIG += c++11 link_pkgconfig
QT = qml quickcontrols2
CONFIG += c++11 link_pkgconfig
-PKGCONFIG += qtappfw-mediaplayer
+PKGCONFIG += qtappfw-mediaplayer qtappfw-vehicle-signals
#include <QQuickWindow>
#include <mediaplayer.h>
#include <QQuickWindow>
#include <mediaplayer.h>
+#include <vehiclesignals.h>
QQmlContext *context = engine.rootContext();
context->setContextProperty("AlbumArt", "");
context->setContextProperty("mediaplayer", new Mediaplayer(context));
QQmlContext *context = engine.rootContext();
context->setContextProperty("AlbumArt", "");
context->setContextProperty("mediaplayer", new Mediaplayer(context));
+ VehicleSignalsConfig vsConfig("mediaplayer");
+ context->setContextProperty("VehicleSignals", new VehicleSignals(vsConfig));
engine.load(QUrl(QStringLiteral("qrc:/MediaPlayer.qml")));
engine.load(QUrl(QStringLiteral("qrc:/MediaPlayer.qml")));