feiyu02
2025-08-05 176d7d8283e66ccf63878c9ab823e900df94b748
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
    var sensorId: String? = null
 
    //监测因子实际值
    var factorData: Double? = null
 
    //监测因子物理量(电压)
    var physicalQuantity: Double? = null
 
    //状态位
    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
    }
}