From 879378a9a2e73278dc822c97f8d1dda589919b6d Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 21 五月 2021 17:36:44 +0800 Subject: [PATCH] 1. 根据新的协议,扩展了设备编号的位数从1位至6位; 2. 新增监测因子无人机高度; --- src/test/kotlin/com/flightfeather/uav/Test.kt | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) diff --git a/src/test/kotlin/com/flightfeather/uav/Test.kt b/src/test/kotlin/com/flightfeather/uav/Test.kt index 6152cdb..38e6067 100644 --- a/src/test/kotlin/com/flightfeather/uav/Test.kt +++ b/src/test/kotlin/com/flightfeather/uav/Test.kt @@ -1,10 +1,50 @@ package com.flightfeather.uav +import com.flightfeather.uav.common.utils.FileExchange +import com.flightfeather.uav.socket.bean.DataUnit +import com.flightfeather.uav.socket.decoder.AirDataDecoder +import com.flightfeather.uav.socket.eunm.AirCommandUnit +import com.google.gson.Gson +import org.junit.Test +import java.io.File +import java.io.FileOutputStream +import java.io.OutputStreamWriter +import java.text.SimpleDateFormat +import java.util.* + /** * @author riku * Date: 2019/9/12 */ class Test { + @Test + fun foo1() { + val s = SimpleDateFormat.getDateTimeInstance().format(Date()) + println(s) + } + @Test + fun foo2() { + val file = File("E:\\VSprojects\\uav-monitor\\asset\\data\\data-2020-12-24-01-34-24.txt") + val outFile = File("E:\\VSprojects\\uav-monitor\\asset\\data\\data.json") + val out = OutputStreamWriter(FileOutputStream(outFile)) + val list = mutableListOf<List<DataUnit>>() + file.readLines().forEach { + val p = AirDataDecoder.instance.decode(it) +// val str = Gson().toJson(p.dataUnit) + if (p.commandUnit == AirCommandUnit.AirData.value) { + list.add(p.dataUnit) + } + } + val str = Gson().toJson(list) + out.append(str) + out.flush() + out.close() + } + + @Test + fun dataChange() { + FileExchange().doTask2() + } } \ No newline at end of file -- Gitblit v1.9.3