src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/RealTimeDataDecoderImpl.kt
@@ -1,7 +1,7 @@
package com.flightfeather.obd.socket.decoder.impl
import com.flightfeather.obd.socket.bean.EngineDataStream
import com.flightfeather.obd.socket.bean.ObdData
import com.flightfeather.obd.socket.bean.ObdInfo
import com.flightfeather.obd.socket.bean.SupplementDataStream
import com.flightfeather.obd.socket.decoder.RealTimeDataDecoder
import com.flightfeather.obd.socket.eunm.ObdDataType
@@ -12,7 +12,7 @@
 * Date: 2019/9/15
 */
class RealTimeDataDecoderImpl : RealTimeDataDecoder {
    override fun getObdData(time: Date?, serialNum: Int, b: List<String>): ObdData? {
    override fun getObdData(time: Date?, serialNum: Int, b: List<String>): ObdInfo? {
        val dataList = mutableListOf<String>().apply { addAll(b) }
        if (b.isNotEmpty()) {
            //去除 信息类型标志
@@ -46,7 +46,7 @@
                }
            }
            return ObdData(time, serialNum).apply {
            return ObdInfo(time, serialNum).apply {
                obdProtocol = dataList[0].toIntOrNull(16)
                obdMil = dataList[1].toIntOrNull(16)
                diagnosisSupportStatus = "${dataList[2]}${dataList[3]}".toIntOrNull(16)?.toString(2)
@@ -54,7 +54,7 @@
                obdVin = vin.toString()
                obdCrn = softwareCode.toString()
                obdCvn = cvn.toString()
                this.IUPR = IUPR.toString()
                this.iupr = IUPR.toString()
                obdFaultCodeNum = faultCodeNum
                obdFaultCode = faultCode.toString()
            }
@@ -78,8 +78,8 @@
                obdFrictionTorque = dataList[4].toIntOrNull(16)?.minus(125)?.toDouble()?.div(100)
                obdEngineRpm = "${dataList[5]}${dataList[6]}".toIntOrNull(16)?.toDouble()?.times(0.125)
                obdEngineFuelFlow = "${dataList[7]}${dataList[8]}".toIntOrNull(16)?.toDouble()?.times(0.05)
                obdScrUpstreamNo = "${dataList[9]}${dataList[10]}".toIntOrNull(16)?.minus(200)?.toDouble()?.times(0.05)
                obdScrDownstreamNo = "${dataList[11]}${dataList[12]}".toIntOrNull(16)?.minus(200)?.toDouble()?.times(0.05)
                obdScrUpstreamNox = "${dataList[9]}${dataList[10]}".toIntOrNull(16)?.minus(200)?.toDouble()?.times(0.05)
                obdScrDownstreamNox = "${dataList[11]}${dataList[12]}".toIntOrNull(16)?.minus(200)?.toDouble()?.times(0.05)
                obdRemainReactant = dataList[13].toIntOrNull(16)?.toDouble()?.times(0.4)?.div(100)
                obdAirInput = "${dataList[14]}${dataList[15]}".toIntOrNull(16)?.toDouble()?.times(0.05)
                obdScrInputTemp = "${dataList[16]}${dataList[17]}".toIntOrNull(16)?.minus(273)?.toDouble()?.times(0.03125)