1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-03 17:02:13 +01:00

AsteroidOS: Add simple device discovery

This is done by just comparing the names with already existing devices.
This is only a temporary solution until the discovery of the service
UUID works properly
This commit is contained in:
Noodlez 2023-01-03 15:56:54 -08:00 committed by Gitea
parent d3d4baedea
commit 616ec53086
2 changed files with 17 additions and 0 deletions

View File

@ -3,6 +3,18 @@ package nodomain.freeyourgadget.gadgetbridge.devices.asteroidos;
import java.util.UUID;
public class AsteroidOSConstants {
// A list of all the supported devices and their codenames
public static final String[] SUPPORTED_DEVICE_CODENAMES = {
"bass", "sturgeon", "catfish", "catfish_ext",
"catshark", "lenok", "smelt", "carp",
"sparrow", "wren", "anthias", "beluga",
"dory", "firefish", "harmony", "inharmony",
"narwhal", "ray", "sawfish", "sawshark",
"skipjack", "tunny", "mooneye", "swift",
"minnow", "sprat", "tetra"
};
// AsteroidOS Service Watch Filter UUID
public static final UUID SERVICE_UUID = UUID.fromString("00000000-0000-0000-0000-00A57E401D05");

View File

@ -73,6 +73,11 @@ public class AsteroidOSDeviceCoordinator extends AbstractDeviceCoordinator {
if (candidate.supportsService(AsteroidOSConstants.SERVICE_UUID)) {
return DeviceType.ASTEROIDOS;
}
for (String name : AsteroidOSConstants.SUPPORTED_DEVICE_CODENAMES) {
if (candidate.getName().equals(name)) {
return DeviceType.ASTEROIDOS;
}
}
return DeviceType.UNKNOWN;
}