mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-30 22:12:55 +01:00
workaround for missing Miband pairing (assume Miband when device name is not set)
This commit is contained in:
parent
13d734b0f1
commit
45631fb14b
@ -256,15 +256,16 @@ public class BluetoothCommunicationService extends Service {
|
|||||||
BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(btDeviceAddress);
|
BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(btDeviceAddress);
|
||||||
if (btDevice != null) {
|
if (btDevice != null) {
|
||||||
GBDevice.Type deviceType = GBDevice.Type.UNKNOWN;
|
GBDevice.Type deviceType = GBDevice.Type.UNKNOWN;
|
||||||
if (btDevice.getName().indexOf("Pebble") == 0) {
|
if (btDevice.getName() == null || btDevice.getName().equals("MI")) { //FIXME: workaround for Miband not being paired
|
||||||
deviceType = GBDevice.Type.PEBBLE;
|
|
||||||
mGBDeviceProtocol = new PebbleProtocol();
|
|
||||||
mGBDeviceIoThread = new PebbleIoThread(btDeviceAddress);
|
|
||||||
} else if (btDevice.getName().equals("MI")) {
|
|
||||||
deviceType = GBDevice.Type.MIBAND;
|
deviceType = GBDevice.Type.MIBAND;
|
||||||
mGBDeviceProtocol = new MibandProtocol();
|
mGBDeviceProtocol = new MibandProtocol();
|
||||||
mGBDeviceIoThread = new MibandIoThread(btDeviceAddress);
|
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) {
|
if (mGBDeviceProtocol != null) {
|
||||||
mGBDevice = new GBDevice(btDeviceAddress, btDevice.getName(), deviceType);
|
mGBDevice = new GBDevice(btDeviceAddress, btDevice.getName(), deviceType);
|
||||||
mGBDevice.setState(GBDevice.State.CONNECTING);
|
mGBDevice.setState(GBDevice.State.CONNECTING);
|
||||||
|
Loading…
Reference in New Issue
Block a user