1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-27 20:36:51 +01:00

PebbleProtocol: Do not call encodeSetMusicState in encodeSetMusicInfo

encodeSetMusicState will be accessible on its own. If it was used to set
the music state, a call to encodeSetMusicInfo must not reset this info
arbitrarily.
This commit is contained in:
Steffen Liebergeld 2016-06-08 20:16:28 +02:00
parent 389a143bdb
commit 0470731e4b

View File

@ -1126,7 +1126,6 @@ public class PebbleProtocol extends GBDeviceProtocol {
if (duration == 0) {
return encodeMessage(ENDPOINT_MUSICCONTROL, MUSICCONTROL_SETMUSICINFO, 0, parts);
} else {
byte[] stateMessage = encodeSetMusicState(MUSICCONTROL_STATE_PLAYING, 0, 100, (byte) 1, (byte) 1);
// Calculate length first
int length = LENGTH_PREFIX + 9;
if (parts != null) {
@ -1140,7 +1139,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
}
// Encode Prefix
ByteBuffer buf = ByteBuffer.allocate(length + stateMessage.length);
ByteBuffer buf = ByteBuffer.allocate(length);
buf.order(ByteOrder.BIG_ENDIAN);
buf.putShort((short) (length - LENGTH_PREFIX));
buf.putShort(ENDPOINT_MUSICCONTROL);
@ -1164,8 +1163,6 @@ public class PebbleProtocol extends GBDeviceProtocol {
buf.putShort((short) (trackCount & 0xffff));
buf.putShort((short) (trackNr & 0xffff));
buf.put(stateMessage);
return buf.array();
}
}