diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casiogb6900/CasioGB6900Constants.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casiogb6900/CasioGB6900Constants.java index 52fc0ea499..b2b97d738e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casiogb6900/CasioGB6900Constants.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casiogb6900/CasioGB6900Constants.java @@ -29,6 +29,10 @@ public final class CasioGB6900Constants { public static final UUID CCC_DESCRIPTOR_UUID = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); + // Immediate Alert + + public static final UUID IMMEDIATE_ALERT_SERVICE_UUID = UUID.fromString("00001802-0000-1000-8000-00805f9b34fb"); + // Alert public static final UUID ALERT_SERVICE_UUID = UUID.fromString("26eb0000-b012-49a8-b1f8-394fb2032b0f"); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casiogb6900/CasioGB6900DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casiogb6900/CasioGB6900DeviceSupport.java index 1d82a4c509..7870e0f5bb 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casiogb6900/CasioGB6900DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casiogb6900/CasioGB6900DeviceSupport.java @@ -74,6 +74,7 @@ public class CasioGB6900DeviceSupport extends AbstractBTLEDeviceSupport { addSupportedService(CasioGB6900Constants.MORE_ALERT_SERVICE_UUID); addSupportedService(CasioGB6900Constants.TX_POWER_SERVICE_UUID); addSupportedService(CasioGB6900Constants.LINK_LOSS_SERVICE); + addSupportedService(CasioGB6900Constants.IMMEDIATE_ALERT_SERVICE_UUID); mThread = new CasioGATTThread(getContext(), this); } @@ -605,7 +606,18 @@ public class CasioGB6900DeviceSupport extends AbstractBTLEDeviceSupport { @Override public void onFindDevice(boolean start) { if(start) { - showNotification(CasioGB6900Constants.SNS_NOTIFICATION_ID, "You found it!", ""); + try { + TransactionBuilder builder = performInitialized("findDevice"); + byte value[] = new byte[]{GattCharacteristic.HIGH_ALERT}; + + BluetoothGattService service = mBtGatt.getService(CasioGB6900Constants.IMMEDIATE_ALERT_SERVICE_UUID); + BluetoothGattCharacteristic charact = service.getCharacteristic(CasioGB6900Constants.ALERT_LEVEL_CHARACTERISTIC_UUID); + builder.write(charact, value); + LOG.info("onFindDevice sent"); + builder.queue(getQueue()); + } catch (IOException e) { + LOG.warn("showNotification failed: " + e.getMessage()); + } } }