mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 21:06:50 +01:00
Xiaomi: temporary fix for database errors when reconnecting
This commit is contained in:
parent
7f68dc5449
commit
b395e889c3
@ -113,8 +113,10 @@ public class XiaomiBleSupport extends XiaomiConnectionSupport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME unsetDynamicState unsets the fw version, which causes problems..
|
// FIXME unsetDynamicState unsets the fw version, which causes problems..
|
||||||
if (getDevice().getFirmwareVersion() == null && mXiaomiSupport.getCachedFirmwareVersion() != null) {
|
if (getDevice().getFirmwareVersion() == null) {
|
||||||
getDevice().setFirmwareVersion(mXiaomiSupport.getCachedFirmwareVersion());
|
getDevice().setFirmwareVersion(mXiaomiSupport.getCachedFirmwareVersion() != null ?
|
||||||
|
mXiaomiSupport.getCachedFirmwareVersion() :
|
||||||
|
"N/A");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btCharacteristicCommandRead == null || btCharacteristicCommandWrite == null) {
|
if (btCharacteristicCommandRead == null || btCharacteristicCommandWrite == null) {
|
||||||
|
@ -71,8 +71,10 @@ public class XiaomiSppSupport extends XiaomiConnectionSupport {
|
|||||||
@Override
|
@Override
|
||||||
protected TransactionBuilder initializeDevice(TransactionBuilder builder) {
|
protected TransactionBuilder initializeDevice(TransactionBuilder builder) {
|
||||||
// FIXME unsetDynamicState unsets the fw version, which causes problems..
|
// FIXME unsetDynamicState unsets the fw version, which causes problems..
|
||||||
if (getDevice().getFirmwareVersion() == null && mXiaomiSupport.getCachedFirmwareVersion() != null) {
|
if (getDevice().getFirmwareVersion() == null) {
|
||||||
getDevice().setFirmwareVersion(mXiaomiSupport.getCachedFirmwareVersion());
|
getDevice().setFirmwareVersion(mXiaomiSupport.getCachedFirmwareVersion() != null ?
|
||||||
|
mXiaomiSupport.getCachedFirmwareVersion() :
|
||||||
|
"N/A");
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.add(new SetDeviceStateAction(getDevice(), GBDevice.State.INITIALIZING, getContext()));
|
builder.add(new SetDeviceStateAction(getDevice(), GBDevice.State.INITIALIZING, getContext()));
|
||||||
|
@ -178,7 +178,7 @@ public class XiaomiSupport extends AbstractDeviceSupport {
|
|||||||
|
|
||||||
public void setContext(final GBDevice device, final BluetoothAdapter adapter, final Context context) {
|
public void setContext(final GBDevice device, final BluetoothAdapter adapter, final Context context) {
|
||||||
// FIXME unsetDynamicState unsets the fw version, which causes problems..
|
// FIXME unsetDynamicState unsets the fw version, which causes problems..
|
||||||
if (getCachedFirmwareVersion() == null && device.getFirmwareVersion() != null) {
|
if (device.getFirmwareVersion() != null) {
|
||||||
setCachedFirmwareVersion(device.getFirmwareVersion());
|
setCachedFirmwareVersion(device.getFirmwareVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user