From 57b3b0851b2144073522a43640c2acc9452e1719 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 30 十月 2019 14:52:34 +0800
Subject: [PATCH] 新增接口: 1. 获取车辆轨迹
---
src/main/kotlin/com/flightfeather/obd/socket/decoder/impl/DataUnitDecoderImpl.kt | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 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..ecc85ab 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,9 @@
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 org.slf4j.LoggerFactory
import java.lang.StringBuilder
import java.util.*
-import javax.annotation.PostConstruct
/**
* @author riku
@@ -16,6 +14,7 @@
*/
class DataUnitDecoderImpl : DataUnitDecoder {
+ private val logger = LoggerFactory.getLogger(javaClass.name)
private var realTimeDataDecoder: RealTimeDataDecoder = RealTimeDataDecoderImpl()
override fun getCarRegisterData(b: List<String>): List<CarRegisterData> {
@@ -35,10 +34,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 +50,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 +71,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
}
@@ -86,7 +85,8 @@
}
}else if (dataList.isNotEmpty()) {
//鎸夌収瑙勫垯娌℃湁鍙栧埌淇℃伅浣擄紝骞朵笖鍘熸暟鎹笉涓虹┖锛岃〃绀哄師鏁版嵁鏍煎紡閿欒锛岄��鍑哄惊鐜�
-// break
+ logger.error("-------鏁版嵁淇℃伅娴佹垨琛ュ厖鏁版嵁娴佹牸寮忛敊璇�")
+ break
}
}
@@ -119,6 +119,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