1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-27 20:36:51 +01:00

workaround for missing Miband pairing (assume Miband when device name is not set)

This commit is contained in:
Andreas Shimokawa 2015-04-01 23:15:08 +02:00
parent 13d734b0f1
commit 45631fb14b

View File

@ -256,15 +256,16 @@ public class BluetoothCommunicationService extends Service {
BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(btDeviceAddress);
if (btDevice != null) {
GBDevice.Type deviceType = GBDevice.Type.UNKNOWN;
if (btDevice.getName().indexOf("Pebble") == 0) {
deviceType = GBDevice.Type.PEBBLE;
mGBDeviceProtocol = new PebbleProtocol();
mGBDeviceIoThread = new PebbleIoThread(btDeviceAddress);
} else if (btDevice.getName().equals("MI")) {
if (btDevice.getName() == null || btDevice.getName().equals("MI")) { //FIXME: workaround for Miband not being paired
deviceType = GBDevice.Type.MIBAND;
mGBDeviceProtocol = new MibandProtocol();
mGBDeviceIoThread = new MibandIoThread(btDeviceAddress);
}
else if (btDevice.getName().indexOf("Pebble") == 0) {
deviceType = GBDevice.Type.PEBBLE;
mGBDeviceProtocol = new PebbleProtocol();
mGBDeviceIoThread = new PebbleIoThread(btDeviceAddress);
}
if (mGBDeviceProtocol != null) {
mGBDevice = new GBDevice(btDeviceAddress, btDevice.getName(), deviceType);
mGBDevice.setState(GBDevice.State.CONNECTING);