diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiInstallHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiInstallHandler.java index dc5e4fb9b..b7c5098a6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiInstallHandler.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiInstallHandler.java @@ -24,6 +24,7 @@ import android.text.TextUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Arrays; import java.util.List; import nodomain.freeyourgadget.gadgetbridge.R; @@ -91,7 +92,7 @@ public class HuaweiInstallHandler implements InstallHandler { LOG.info("bitrate {}", restrictions.bitrate); LOG.info("channels {}", restrictions.channels); LOG.info("musicEncode {}", restrictions.musicEncode); - LOG.info("sampleRate {}", restrictions.sampleRate); + LOG.info("sampleRate {}", Arrays.toString(restrictions.sampleRates)); LOG.info("unknownBitrate {}", restrictions.unknownBitrate); if(currentMusicInfo.getChannels() > restrictions.channels) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiMusicUtils.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiMusicUtils.java index 2b8f2c028..a3cc2e3ea 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiMusicUtils.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiMusicUtils.java @@ -1,6 +1,7 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huawei; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class HuaweiMusicUtils { @@ -32,10 +33,10 @@ public class HuaweiMusicUtils { public static class FormatRestrictions { public byte formatIdx = -1; - public int sampleRate = -1; // TODO: not sure + public String[] sampleRates = null; public byte musicEncode = -1; // TODO: not sure public short bitrate = -1; - public byte channels = -1; + public byte channels = 2; public short unknownBitrate = -1; // TODO: not sure // TODO: I am not sure about this. Most of formats unknown for me. @@ -49,7 +50,7 @@ public class HuaweiMusicUtils { public String toString() { final StringBuffer sb = new StringBuffer("FormatRestrictions{"); sb.append("formatIdx=").append(formatIdx); - sb.append(", sampleRate=").append(sampleRate); + sb.append(", sampleRates=").append(Arrays.toString(sampleRates)); sb.append(", musicEncode=").append(musicEncode); sb.append(", bitrate=").append(bitrate); sb.append(", channels=").append(channels); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/MusicControl.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/MusicControl.java index 3509d71ab..3560e58fd 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/MusicControl.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/MusicControl.java @@ -343,8 +343,10 @@ public class MusicControl { HuaweiMusicUtils.FormatRestrictions restriction = new HuaweiMusicUtils.FormatRestrictions(); if (subTlv.contains(0x08)) restriction.formatIdx = subTlv.getByte(0x08); - if (subTlv.contains(0x09)) - restriction.sampleRate = subTlv.getInteger(0x09); + if (subTlv.contains(0x09)) { + String sampleRates = subTlv.getString(0x09); + restriction.sampleRates = sampleRates.split(","); + } if (subTlv.contains(0x0a)) restriction.musicEncode = subTlv.getByte(0x0a); if (subTlv.contains(0x0b))