mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 10:35:50 +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:
parent
46739be9ed
commit
c380cf98bb
@ -147,7 +147,9 @@ public class MusicControl {
|
|||||||
public void parseTlv() throws ParseException {
|
public void parseTlv() throws ParseException {
|
||||||
if (this.tlv.contains(0x01)) {
|
if (this.tlv.contains(0x01)) {
|
||||||
this.buttonPresent = true;
|
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) {
|
switch (this.rawButton) {
|
||||||
case 1:
|
case 1:
|
||||||
this.button = Button.Play;
|
this.button = Button.Play;
|
||||||
@ -169,6 +171,10 @@ public class MusicControl {
|
|||||||
break;
|
break;
|
||||||
case 64:
|
case 64:
|
||||||
// Unknown button on Huawei Band 4
|
// Unknown button on Huawei Band 4
|
||||||
|
|
||||||
|
case 100:
|
||||||
|
// Seems like exit from music control screen to other screen
|
||||||
|
this.buttonPresent = false;
|
||||||
default:
|
default:
|
||||||
this.button = Button.Unknown;
|
this.button = Button.Unknown;
|
||||||
}
|
}
|
||||||
@ -176,7 +182,9 @@ public class MusicControl {
|
|||||||
|
|
||||||
if (this.tlv.contains(0x02)) {
|
if (this.tlv.contains(0x02)) {
|
||||||
this.volumePresent = true;
|
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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user