1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package cn.flightfeather.supervision.websocket
 
/**
 * @author riku
 * Date: 2019/12/2
 */
enum class DeviceType(val index: Int, val describe: String) {
    Unknown(-1, "unknown"),
    PC(0, "PC"),
    Android(1, "Android"),
    IOS(2, "IOS")
}
 
fun getDeviceType(describe: String): DeviceType = when (describe) {
    "PC" -> DeviceType.PC
    "Android" -> DeviceType.Android
    "IOS" -> DeviceType.IOS
    else -> DeviceType.Unknown
}