GadgetBridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java

36 lines
727 B
Java
Raw Normal View History

package nodomain.freeyourgadget.gadgetbridge.model;
2015-10-26 23:32:03 +01:00
/**
* For every supported device, a device type constant must exist.
*
* Note: they key of every constant is stored in the DB, so it is fixed forever,
* and may not be changed.
2015-10-26 23:32:03 +01:00
*/
public enum DeviceType {
UNKNOWN(-1),
PEBBLE(1),
MIBAND(10),
MIBAND2(11),
VIBRATISSIMO(20),
TEST(1000);
private final int key;
DeviceType(int key) {
this.key = key;
}
public int getKey() {
return key;
}
public static DeviceType fromKey(int key) {
for (DeviceType type : values()) {
if (type.key == key) {
return type;
}
}
return DeviceType.UNKNOWN;
}
}