1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-25 19:36:50 +01:00

Merge pull request #144 from sarg/master

Initial support for newer MI devices.
This commit is contained in:
Carsten Pfeiffer 2015-10-18 09:57:13 +02:00
commit 1073303849
2 changed files with 3 additions and 1 deletions

View File

@ -183,6 +183,8 @@ public class DeviceCommunicationService extends Service {
} else { } else {
deviceSupport.connect(); deviceSupport.connect();
} }
} else {
GB.toast(this, getString(R.string.cannot_connect, "Can't create device support"), Toast.LENGTH_SHORT, GB.ERROR);
} }
} catch (Exception e) { } catch (Exception e) {
GB.toast(this, getString(R.string.cannot_connect, e.getMessage()), Toast.LENGTH_SHORT, GB.ERROR); GB.toast(this, getString(R.string.cannot_connect, e.getMessage()), Toast.LENGTH_SHORT, GB.ERROR);

View File

@ -79,7 +79,7 @@ public class DeviceSupportFactory {
try { try {
BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(deviceAddress); BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(deviceAddress);
if (btDevice.getName() == null || btDevice.getName().equals("MI")) { //FIXME: workaround for Miband not being paired if (btDevice.getName() == null || btDevice.getName().startsWith("MI")) { //FIXME: workaround for Miband not being paired
gbDevice = new GBDevice(deviceAddress, "MI", DeviceType.MIBAND); gbDevice = new GBDevice(deviceAddress, "MI", DeviceType.MIBAND);
deviceSupport = new ServiceDeviceSupport(new MiBandSupport(), EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING)); deviceSupport = new ServiceDeviceSupport(new MiBandSupport(), EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING));
} else if (btDevice.getName().indexOf("Pebble") == 0) { } else if (btDevice.getName().indexOf("Pebble") == 0) {