mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-01 06:22:55 +01:00
Device connection: classify more states as reconnecting
This commit is contained in:
parent
a75b3afc84
commit
ee1c3e4db9
@ -310,7 +310,7 @@ public class GBDevice implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
return mState.ordinal() >= State.CONNECTED.ordinal();
|
return mState.equalsOrHigherThan(State.CONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInitializing() {
|
public boolean isInitializing() {
|
||||||
@ -761,8 +761,8 @@ public class GBDevice implements Parcelable {
|
|||||||
return simpleStringId;
|
return simpleStringId;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean equalsOrHigherThan(State otherState){
|
public boolean equalsOrHigherThan(State otherState){
|
||||||
return ordinal() >= otherState.ordinal();
|
return compareTo(otherState) >= 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1145,7 +1145,10 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDeviceReconnecting(GBDevice device) {
|
private boolean isDeviceReconnecting(GBDevice device) {
|
||||||
return deviceStateEquals(device, GBDevice.State.WAITING_FOR_RECONNECT, GBDevice.State.WAITING_FOR_SCAN);
|
if((device = getDeviceByAddressOrNull(device.getAddress())) != null){
|
||||||
|
return device.getState().equalsOrHigherThan(GBDevice.State.NOT_CONNECTED);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean deviceHasCalendarReceiverRegistered(GBDevice device){
|
private boolean deviceHasCalendarReceiverRegistered(GBDevice device){
|
||||||
|
Loading…
Reference in New Issue
Block a user