| | |
| | | enum class UWDeviceType(val value: String, val des: String) { |
| | | UAV("0b", "无人机设备"), |
| | | VEHICLE("0a", "车载设备"), |
| | | BOAT("0c", "无人船设备"), |
| | | GRID("0d", "网格化设备"); |
| | | |
| | | companion object { |
| | | /** |
| | | * 根据设备编号获取设备类型 |
| | | */ |
| | | fun getType(deviceCode: String?): UWDeviceType? = when (deviceCode?.substring(0, 2)) { |
| | | fun getType(deviceCode: String?): UWDeviceType? = fromValue(deviceCode?.substring(0, 2)) |
| | | |
| | | fun fromValue(value: String?): UWDeviceType? = when (value) { |
| | | UAV.value -> UAV |
| | | VEHICLE.value -> VEHICLE |
| | | BOAT.value -> BOAT |
| | | GRID.value -> GRID |
| | | else -> null |
| | | } |