From 9a1bdc9136a5a4aaebabaa0f44aab4c0eede8177 Mon Sep 17 00:00:00 2001 From: TaaviE Date: Sat, 24 Mar 2018 14:50:19 +0200 Subject: [PATCH] Removed the strict ordering requirement and fixed the docstrings. --- .../gadgetbridge/impl/GBDevice.java | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDevice.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDevice.java index 7f3dbbbfc..551c146cc 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDevice.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDevice.java @@ -492,20 +492,31 @@ public class GBDevice implements Parcelable { } public enum State { - // Note: the order is important! - NOT_CONNECTED, - WAITING_FOR_RECONNECT, - CONNECTING, - CONNECTED, - INITIALIZING, - AUTHENTICATION_REQUIRED, // some kind of pairing is required by the device - AUTHENTICATING, // some kind of pairing is requested by the device + NOT_CONNECTED(0), + WAITING_FOR_RECONNECT(1), + CONNECTING(2), + CONNECTED(3), + INITIALIZING(4), + /** Some kind of pairing is required by the device */ + AUTHENTICATION_REQUIRED(5), + /** Some kind of pairing is requested by the device */ + AUTHENTICATING(6), /** * Means that the device is connected AND all the necessary initialization steps * have been performed. At the very least, this means that basic information like * device name, firmware version, hardware revision (as applicable) is available * in the GBDevice. */ - INITIALIZED, + INITIALIZED(7); + + private int state; + + State(int value) { + this.state = value; + } + + public int getValue() { + return state; + } } }