1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 10:05:49 +01:00

Huawei: Fix Watch 3 music control

* it using integer button fields
*  it has button code 100 means exit from music
control screen, no need to poll music info on this code
This commit is contained in:
Vitaliy Tomin 2024-07-26 18:40:41 +08:00 committed by José Rebelo
parent 46739be9ed
commit c380cf98bb

View File

@ -147,7 +147,9 @@ public class MusicControl {
public void parseTlv() throws ParseException {
if (this.tlv.contains(0x01)) {
this.buttonPresent = true;
this.rawButton = this.tlv.getByte(0x01);
// Only grab the lowest byte
byte[] bytes = this.tlv.getBytes(0x01);
this.rawButton = bytes[bytes.length - 1];
switch (this.rawButton) {
case 1:
this.button = Button.Play;
@ -169,6 +171,10 @@ public class MusicControl {
break;
case 64:
// Unknown button on Huawei Band 4
case 100:
// Seems like exit from music control screen to other screen
this.buttonPresent = false;
default:
this.button = Button.Unknown;
}
@ -176,7 +182,9 @@ public class MusicControl {
if (this.tlv.contains(0x02)) {
this.volumePresent = true;
this.volume = this.tlv.getByte(0x02);
// Only grab the lowest byte
byte[] bytes = this.tlv.getBytes(0x02);
this.volume = bytes[bytes.length - 1];
}
}
}