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
1 changed files with 6 additions and 5 deletions

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);