desc:折线图补点问题

main
xiaowusky 2 years ago
parent 92ccd42422
commit 22fc7c31ee

@ -8,11 +8,9 @@ import android.os.FileUtils
import android.provider.Settings
import com.common.commonlib.db.DBUtils
import com.common.commonlib.db.entity.Gas
import com.common.commonlib.db.entity.GasType
import com.common.commonlib.db.entity.Video
import com.common.commonlib.db.entity.Warning
import com.yinuo.library.vlc.PushHelper
import com.yinuo.library.vlc.TxtOverlay
import com.yinuo.safetywatcher.watcher.net.UploadFileApi
import com.yinuo.safetywatcher.watcher.ui.view.CommonDialog
import com.yinuo.safetywatcher.watcher.utils.DateUtils
@ -31,35 +29,11 @@ object TestUtils {
fun insertData() {
TxtOverlay.setShowTip("co2:50%@co:44%")
PushHelper.setPushUrl("rtsp://192.168.5.17:554/123")
GlobalScope.launch() {
// 构造气体数据
val timeMillis = System.currentTimeMillis()
// val gasDao = DBUtils.gasDao()
// val gases = mutableListOf<Gas>()
// gases.add(Gas(timeMillis - 150 * 1000, "CO", 5.0))
// gases.add(Gas(timeMillis - 150 * 1000, "O2", 5.0))
// gases.add(Gas(timeMillis - 150 * 1000, "CO2", 5.0))
//
// gases.add(Gas(timeMillis - 100 * 1000, "CO2", 4.0))
// gases.add(Gas(timeMillis - 100 * 1000, "CO", 4.0))
// gases.add(Gas(timeMillis - 100 * 1000, "O2", 4.0))
//
// gases.add(Gas(timeMillis - 45 * 1000, "O2", 3.0))
// gases.add(Gas(timeMillis - 45 * 1000, "CO", 3.0))
// gases.add(Gas(timeMillis - 45 * 1000, "CO2", 3.0))
//
// gases.add(Gas(timeMillis - 30_000, "CO", 2.0))
// gases.add(Gas(timeMillis - 30_000, "CO2", 2.0))
// gases.add(Gas(timeMillis - 30_000, "O2", 2.0))
//
// gases.add(Gas(timeMillis, "CO", 1.0))
// gases.add(Gas(timeMillis, "CO2", 1.0))
// gases.add(Gas(timeMillis, "O2", 1.0))
// gasDao.insertAll(gases)
// 构造告警数据
val warningDao = DBUtils.warningDao()
val warnings = mutableListOf<Warning>()

@ -41,6 +41,10 @@ object ParseHelper {
val gasIndex = it[0].toInt()
val status = it[14].toInt()
val gasType = getGasTypeByCode(it[19].toInt())
if (gasType.isEmpty()) {
LogUtils.v("receive msg, unknown gas")
return
}
when (status) {
// 预热
0 -> {

@ -161,6 +161,11 @@ class QueryDataActivity : BaseActivity() {
startGas!!.gasValue = gasValue / count
startGas!!.time = tempTime
newMapList.add(startGas!!)
tempTime += intervalMs
startGas = gas
gasValue = gas.gasValue
count = 1
}
val offsetTime = gas.time - tempTime
val num = offsetTime / intervalMs
@ -170,10 +175,6 @@ class QueryDataActivity : BaseActivity() {
newMapList.add(gas.copy(time = tempTime, gasValue = -1.0))
}
}
tempTime += intervalMs
startGas = gas
gasValue = gas.gasValue
count = 1
} else {
gasValue += gas.gasValue
count++

Loading…
Cancel
Save