1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 05:16:51 +01:00

Fossil HR: Implement next/previous track

This commit is contained in:
Andreas Shimokawa 2020-01-29 20:02:46 +01:00
parent 7618ec39a2
commit 7d73ca3df2
2 changed files with 17 additions and 5 deletions

View File

@ -581,11 +581,9 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
private void handleMusicRequest(byte[] value) {
byte command = value[3];
logger.info("got music command: " + command);
MUSIC_WATCH_REQUEST request = MUSIC_WATCH_REQUEST.fromCommandByte(command);
MusicControlRequest r = new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_PLAY_PAUSE);
GBDeviceEventMusicControl deviceEventMusicControl = new GBDeviceEventMusicControl();
deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.PLAY;
@ -597,6 +595,16 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.PLAYPAUSE;
break;
}
case MUSIC_REQUEST_NEXT: {
queueWrite(new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_NEXT));
deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.NEXT;
break;
}
case MUSIC_REQUEST_PREVIOUS: {
queueWrite(new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_PREVIOUS));
deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.PREVIOUS;
break;
}
case MUSIC_REQUEST_LOUDER: {
queueWrite(new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_LOUDER));
deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.VOLUMEUP;

View File

@ -33,8 +33,10 @@ public class MusicControlRequest extends FossilRequest {
return UUID.fromString("3dda0006-957f-7d4a-34a6-74696673696d");
}
public static enum MUSIC_WATCH_REQUEST{
public enum MUSIC_WATCH_REQUEST {
MUSIC_REQUEST_PLAY_PAUSE((byte) 0x02),
MUSIC_REQUEST_NEXT((byte) 0x03),
MUSIC_REQUEST_PREVIOUS((byte) 0x04),
MUSIC_REQUEST_LOUDER((byte) 0x05),
MUSIC_REQUEST_QUITER((byte) 0x06),
;
@ -52,10 +54,12 @@ public class MusicControlRequest extends FossilRequest {
}
}
public static enum MUSIC_PHONE_REQUEST{
public enum MUSIC_PHONE_REQUEST {
MUSIC_REQUEST_SET_PLAYING((byte) 0x00),
MUSIC_REQUEST_SET_PAUSED((byte) 0x01),
MUSIC_REQUEST_PLAY_PAUSE((byte) 0x02),
MUSIC_REQUEST_NEXT((byte) 0x03),
MUSIC_REQUEST_PREVIOUS((byte) 0x04),
MUSIC_REQUEST_LOUDER((byte) 0x05),
MUSIC_REQUEST_QUITER((byte) 0x06),
;