mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-07-17 10:54:03 +02: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:
parent
389a143bdb
commit
0470731e4b
|
@ -1126,7 +1126,6 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
if (duration == 0) {
|
if (duration == 0) {
|
||||||
return encodeMessage(ENDPOINT_MUSICCONTROL, MUSICCONTROL_SETMUSICINFO, 0, parts);
|
return encodeMessage(ENDPOINT_MUSICCONTROL, MUSICCONTROL_SETMUSICINFO, 0, parts);
|
||||||
} else {
|
} else {
|
||||||
byte[] stateMessage = encodeSetMusicState(MUSICCONTROL_STATE_PLAYING, 0, 100, (byte) 1, (byte) 1);
|
|
||||||
// Calculate length first
|
// Calculate length first
|
||||||
int length = LENGTH_PREFIX + 9;
|
int length = LENGTH_PREFIX + 9;
|
||||||
if (parts != null) {
|
if (parts != null) {
|
||||||
|
@ -1140,7 +1139,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode Prefix
|
// Encode Prefix
|
||||||
ByteBuffer buf = ByteBuffer.allocate(length + stateMessage.length);
|
ByteBuffer buf = ByteBuffer.allocate(length);
|
||||||
buf.order(ByteOrder.BIG_ENDIAN);
|
buf.order(ByteOrder.BIG_ENDIAN);
|
||||||
buf.putShort((short) (length - LENGTH_PREFIX));
|
buf.putShort((short) (length - LENGTH_PREFIX));
|
||||||
buf.putShort(ENDPOINT_MUSICCONTROL);
|
buf.putShort(ENDPOINT_MUSICCONTROL);
|
||||||
|
@ -1164,8 +1163,6 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
buf.putShort((short) (trackCount & 0xffff));
|
buf.putShort((short) (trackCount & 0xffff));
|
||||||
buf.putShort((short) (trackNr & 0xffff));
|
buf.putShort((short) (trackNr & 0xffff));
|
||||||
|
|
||||||
buf.put(stateMessage);
|
|
||||||
|
|
||||||
return buf.array();
|
return buf.array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user