mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 09:01:55 +01:00
Garmin: Allow install agps for sony cpe url
This commit is contained in:
parent
29a10cab59
commit
64258248b6
@ -82,6 +82,11 @@ public class AgpsHandler {
|
||||
reportError(request.getUrl());
|
||||
return null;
|
||||
}
|
||||
} else if (request.getPath().startsWith(("/ephemeris/cpe/sony"))) {
|
||||
if (!garminAgpsFile.isValidSonyCpe()) {
|
||||
reportError(request.getUrl());
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
LOG.warn("Refusing to send agps for unknown url");
|
||||
return null;
|
||||
|
@ -19,6 +19,7 @@ public class GarminAgpsFile {
|
||||
|
||||
public static final byte[] GZ_HEADER = new byte[]{(byte) 0x1f, (byte) 0x8b};
|
||||
public static final byte[] CPE_RXNETWORKS_HEADER = new byte[]{(byte) 0x01, (byte) 0x00, (byte) 0x66};
|
||||
public static final byte[] CPE_SONY_HEADER = new byte[]{(byte) 0x2a, (byte) 0x12, (byte) 0xa0, (byte) 0x02};
|
||||
|
||||
public GarminAgpsFile(final byte[] bytes) {
|
||||
this.bytes = bytes;
|
||||
@ -66,6 +67,10 @@ public class GarminAgpsFile {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isValidSonyCpe() {
|
||||
return ArrayUtils.startsWith(bytes, CPE_SONY_HEADER);
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
return bytes.clone();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user