mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-18 14:47:46 +01:00
TLW64: Support find device
This commit is contained in:
parent
dfd2eb0e10
commit
7c5a2d0e58
@ -24,4 +24,7 @@ public final class TLW64Constants {
|
||||
public static final UUID UUID_SERVICE_NO1 = UUID.fromString("000055ff-0000-1000-8000-00805f9b34fb");
|
||||
public static final UUID UUID_CHARACTERISTIC_CONTROL = UUID.fromString("000033f1-0000-1000-8000-00805f9b34fb");
|
||||
|
||||
// Command bytes
|
||||
public static final byte CMD_ALARM = (byte) 0xab;
|
||||
|
||||
}
|
||||
|
@ -136,6 +136,6 @@ public class TLW64Coordinator extends AbstractDeviceCoordinator {
|
||||
|
||||
@Override
|
||||
public boolean supportsFindDevice() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import android.net.Uri;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -170,7 +171,9 @@ public class TLW64Support extends AbstractBTLEDeviceSupport {
|
||||
|
||||
@Override
|
||||
public void onFindDevice(boolean start) {
|
||||
|
||||
if (start) {
|
||||
setVibration(1, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -222,4 +225,24 @@ public class TLW64Support extends AbstractBTLEDeviceSupport {
|
||||
public void onSendWeather(WeatherSpec weatherSpec) {
|
||||
|
||||
}
|
||||
|
||||
private void setVibration(int duration, int count) {
|
||||
try {
|
||||
TransactionBuilder builder = performInitialized("vibrate");
|
||||
byte[] msg = new byte[]{
|
||||
TLW64Constants.CMD_ALARM,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
(byte) duration,
|
||||
(byte) count,
|
||||
7, // unknown, sniffed by original app
|
||||
1
|
||||
};
|
||||
builder.write(ctrlCharacteristic, msg);
|
||||
builder.queue(getQueue());
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Unable to set vibration", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user