feiyu02
2025-09-30 94fee0b511279679b43e210878d3d36e5a14384b
src/main/kotlin/com/flightfeather/uav/socket/bean/AirData.kt
@@ -1,9 +1,14 @@
package com.flightfeather.uav.socket.bean
import com.fasterxml.jackson.annotation.JsonInclude
import com.flightfeather.uav.socket.eunm.FactorType
import kotlin.math.round
/**
 * @author riku
 * Date: 2020/6/10
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
class AirData : DataUnit() {
    var factorId: String? = null
    var factorName: String? = null
@@ -17,4 +22,14 @@
    //状态位
    var statusList: List<String>? = null
    fun setData(factorType: FactorType, value: Float?) {
        setData(factorType, round(value?.toDouble()?.times(1000) ?: .0) / 1000)
    }
    fun setData(factorType: FactorType, value: Double?) {
        factorId = factorType.value.toString()
        factorName = factorType.des
        factorData = value
    }
}