while(true) {
Packet p = deviceListener.getPacket();
if (p == null) {
continue;
}
processPacket(p);
}
...
public enum Type {
A(1), B(2), C(3);
private int value;
Type(int value) {...}
public int getValue() { ... }
public void setValue() { ... }
}