Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/CheckAuthenticationNeededAc...

26 lines
821 B
Java
Raw Normal View History

package nodomain.freeyourgadget.gadgetbridge.service.devices.miband;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
2016-04-03 21:41:52 +02:00
import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.AbortTransactionAction;
2016-04-03 21:41:52 +02:00
public class CheckAuthenticationNeededAction extends AbortTransactionAction {
private final GBDevice mDevice;
public CheckAuthenticationNeededAction(GBDevice device) {
super();
mDevice = device;
}
@Override
2016-04-03 21:41:52 +02:00
protected boolean shouldAbort() {
// the state is set in MiBandSupport.handleNotificationNotif()
switch (mDevice.getState()) {
case AUTHENTICATION_REQUIRED: // fall through
case AUTHENTICATING:
2016-04-03 21:41:52 +02:00
return true; // abort the whole thing
default:
2016-04-03 21:41:52 +02:00
return false;
}
}
}