diff options
author | Scott Murray <scott.murray@konsulko.com> | 2022-06-07 15:51:47 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2022-07-04 21:16:10 +0000 |
commit | 219b527adbc7996f4ae2e73732114d2daa17c9c5 (patch) | |
tree | 5557d8985080f7adaf5961f5a9f3184e1d639da8 /app/MediaPlayer.qml | |
parent | d53efa6bca224f2c6bec8e7b14b1dff7f12a2d03 (diff) |
Add VIS vehicle signal support
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)
Diffstat (limited to 'app/MediaPlayer.qml')
-rw-r--r-- | app/MediaPlayer.qml | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/app/MediaPlayer.qml b/app/MediaPlayer.qml index 177fe36..95bc22b 100644 --- a/app/MediaPlayer.qml +++ b/app/MediaPlayer.qml @@ -49,6 +49,8 @@ ApplicationWindow { Component.onCompleted : { // Let the mediaplayer backend know we're ready for metadata events mediaplayer.start() + + VehicleSignals.connect() } Connections { @@ -86,6 +88,33 @@ ApplicationWindow { } } + 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 |