Pebble 2: improve connection problems (at least for me)

here
Andreas Shimokawa 2016-11-18 22:38:39 +01:00
parent 96a16245df
commit 66e3de9168
2 changed files with 4 additions and 5 deletions

View File

@ -94,7 +94,7 @@ class PebbleGATTClient extends BluetoothGattCallback {
}
LOG.info("onCharacteristicWrite() " + characteristic.getUuid());
if (characteristic.getUuid().equals(PAIRING_TRIGGER_CHARACTERISTIC) || characteristic.getUuid().equals(CONNECTIVITY_CHARACTERISTIC)) {
mBtDevice.createBond(); // did not work when last tried
//mBtDevice.createBond(); // did not work when last tried
if (oldPebble) {
subscribeToConnectivity(gatt);
@ -139,7 +139,7 @@ class PebbleGATTClient extends BluetoothGattCallback {
if (doPairing) {
BluetoothGattCharacteristic characteristic = gatt.getService(SERVICE_UUID).getCharacteristic(PAIRING_TRIGGER_CHARACTERISTIC);
if ((characteristic.getProperties() & PROPERTY_WRITE) != 0) {
characteristic.setValue(new byte[]{0, 1}); // bits 0=1 1=no slave sec 2=kk 3=samsung kk
characteristic.setValue(new byte[]{1});
gatt.writeCharacteristic(characteristic);
}
else {
@ -173,7 +173,7 @@ class PebbleGATTClient extends BluetoothGattCallback {
if (mBluetoothGatt != null) {
this.close();
}
mBtDevice.createBond();
//mBtDevice.createBond();
mBluetoothGatt = btDevice.connectGatt(mContext, false, this);
}

View File

@ -2,7 +2,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.ble;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGattServerCallback;
import android.bluetooth.BluetoothManager;
import android.content.Context;
@ -13,7 +12,7 @@ import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
public class PebbleLESupport extends BluetoothGattServerCallback {
public class PebbleLESupport {
private static final Logger LOG = LoggerFactory.getLogger(PebbleLESupport.class);
private PipeReader mPipeReader;
private PebbleGATTServer mPebbleGATTServer;