From 259512005923831d1221bd49568751bf519dc020 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 18 九月 2019 23:18:10 +0800
Subject: [PATCH] 1. 修复保存obd 信息体方法未被调用的问题

---
 src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/DataUnitDecoderImpl.kt |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/DataUnitDecoderImpl.kt b/src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/DataUnitDecoderImpl.kt
index ff459d2..a2875b4 100644
--- a/src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/DataUnitDecoderImpl.kt
+++ b/src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/DataUnitDecoderImpl.kt
@@ -4,11 +4,8 @@
 import com.flightfeather.obd.socket.decoder.DataUnitDecoder
 import com.flightfeather.obd.socket.decoder.RealTimeDataDecoder
 import com.flightfeather.obd.socket.eunm.ObdDataType
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
 import java.lang.StringBuilder
 import java.util.*
-import javax.annotation.PostConstruct
 
 /**
  * @author riku
@@ -35,10 +32,10 @@
         val time = decodeDataTime(b)
 
         //鍥芥爣娉�: 璧峰瀛楄妭涓�7 寮�濮嬬殑2涓瓧鑺傝〃绀� 娴佹按鍙�
-        val serialNum = "${b[7]}${b[8]}".toInt(16)
+//        val serialNum = "${b[7]}${b[8]}".toInt(16)
 
         //涓婃捣娉�: 璧峰瀛楄妭涓�6 寮�濮嬬殑2涓瓧鑺傝〃绀� 娴佹按鍙�
-//        val serialNum = "${b[6]}${b[7]}".toInt(16)
+        val serialNum = "${b[6]}${b[7]}".toInt(16)
 
         val dataList = mutableListOf<String>().apply { addAll(b) }
         //鍒犲幓鍓�6浣嶆椂闂�
@@ -51,15 +48,15 @@
         * 鍒犲幓娴佹按鍙凤紝寰楀埌淇℃伅鏍囧織涓庝俊鎭綋鐨勭粍鍚�
         * (鍥芥爣娉曪細鍘婚櫎鍓�6浣嶆椂闂村悗锛岃捣濮嬪瓧鑺備负1 寮�濮嬬殑2涓瓧鑺傝〃绀� 娴佹按鍙�)
         */
-        if (dataList.size >= 2) dataList.removeAt(1)
-        if (dataList.size >= 2) dataList.removeAt(1)
+//        if (dataList.size >= 2) dataList.removeAt(1)
+//        if (dataList.size >= 2) dataList.removeAt(1)
 
         /*
         * 鍒犲幓娴佹按鍙凤紝寰楀埌淇℃伅鏍囧織涓庝俊鎭綋鐨勭粍鍚�
         * (涓婃捣娉曪細鍘婚櫎鍓�6浣嶆椂闂村悗锛岃捣濮嬪瓧鑺備负0 寮�濮嬬殑2涓瓧鑺傝〃绀� 娴佹按鍙�)
         */
-//        if (dataList.isNotEmpty()) dataList.removeAt(0)
-//        if (dataList.isNotEmpty()) dataList.removeAt(0)
+        if (dataList.isNotEmpty()) dataList.removeAt(0)
+        if (dataList.isNotEmpty()) dataList.removeAt(0)
 
         val resultList = mutableListOf<RealTimeData>()
 
@@ -72,8 +69,8 @@
             if (data.isNotEmpty()) {
                 val r = when (data[0].toInt(16)) {
                     ObdDataType.ObdData.value -> realTimeDataDecoder.getObdData(time, serialNum, data)
-                    ObdDataType.EngineDataFlow.value -> realTimeDataDecoder.getEngineDataFlow(time, serialNum, data)
-                    ObdDataType.SupplementDataFlow.value -> realTimeDataDecoder.getSupplementDataFlow(time, serialNum, data)
+                    ObdDataType.EngineDataFlow.value -> realTimeDataDecoder.getEngineDataStream(time, serialNum, data)
+                    ObdDataType.SupplementDataFlow.value -> realTimeDataDecoder.getSupplementDataStream(time, serialNum, data)
                     else -> null
                 }
 
@@ -119,6 +116,7 @@
         val sec = b[5].toInt(16)
         val cal  = Calendar.getInstance().apply {
             set(year, month - 1, day, hour, min, sec)
+            set(Calendar.MILLISECOND, 0)
         }
 
         return cal.time

--
Gitblit v1.9.3