From db8de891e4d49f15755ca52155a697979b747d79 Mon Sep 17 00:00:00 2001 From: Daniel Dakhno Date: Mon, 27 Jan 2020 12:38:20 +0100 Subject: [PATCH] added music control (except skipping) --- .../adapter/fossil_hr/FossilHRWatchAdapter.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil_hr/FossilHRWatchAdapter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil_hr/FossilHRWatchAdapter.java index dbad301f1..8eaeb8d55 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil_hr/FossilHRWatchAdapter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil_hr/FossilHRWatchAdapter.java @@ -26,6 +26,7 @@ import java.util.Iterator; import java.util.TimeZone; import nodomain.freeyourgadget.gadgetbridge.GBApplication; +import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl; import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.HRConfigActivity; import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.NotificationHRConfiguration; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; @@ -567,20 +568,30 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter { MusicControlRequest r = new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_PLAY_PAUSE); + GBDeviceEventMusicControl deviceEventMusicControl = new GBDeviceEventMusicControl(); + deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.PLAY; + + // TODO add skipping/seeking + switch (request) { case MUSIC_REQUEST_PLAY_PAUSE: { queueWrite(new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_PLAY_PAUSE)); + deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.PLAYPAUSE; break; } case MUSIC_REQUEST_LOUDER: { queueWrite(new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_LOUDER)); + deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.VOLUMEUP; break; } case MUSIC_REQUEST_QUITER: { queueWrite(new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_QUITER)); + deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.VOLUMEDOWN; break; } } + + getDeviceSupport().evaluateGBDeviceEvent(deviceEventMusicControl); } @Override