mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-17 21:06:48 +01:00
Improve find device service (now always beeps)
This commit is contained in:
parent
510d13037a
commit
df6547c287
@ -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");
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user