| | |
| | | package com.flightfeather.uav.socket.handler |
| | | |
| | | import com.flightfeather.uav.biz.sourcetrace.RealTimeExceptionAnalysisController |
| | | import com.flightfeather.uav.common.api2word.utils.JsonUtils |
| | | import com.flightfeather.uav.biz.sourcetrace.SourceTraceController |
| | | import com.flightfeather.uav.common.utils.GsonUtils |
| | | import com.flightfeather.uav.domain.entity.BaseRealTimeData |
| | | import com.flightfeather.uav.domain.repository.SceneInfoRep |
| | | import com.flightfeather.uav.lightshare.bean.DataVo |
| | | import com.flightfeather.uav.socket.sender.UnderwayWebSocketSender |
| | | import com.google.gson.JsonSyntaxException |
| | | import io.netty.channel.ChannelHandlerContext |
| | | import io.netty.handler.codec.http.websocketx.TextWebSocketFrame |
| | | import org.springframework.stereotype.Component |
| | | |
| | | /** |
| | | * |
| | |
| | | */ |
| | | class UnderwayWebSocketServerHandler(sceneInfoRep: SceneInfoRep) : BaseHandler() { |
| | | |
| | | private val realTimeExceptionAnalysisController = RealTimeExceptionAnalysisController(sceneInfoRep) |
| | | private val sourceTraceController = SourceTraceController(sceneInfoRep) |
| | | |
| | | override var tag: String = "UAV-WS" |
| | | |
| | |
| | | // Test |
| | | try { |
| | | if (msgTxt == "start") { |
| | | realTimeExceptionAnalysisController.initTask() |
| | | sourceTraceController.initTask() |
| | | } else { |
| | | val data = GsonUtils.parserJsonToArrayBeans(msgTxt, DataVo::class.java) |
| | | data.forEach { |
| | | realTimeExceptionAnalysisController.addOneData( |
| | | sourceTraceController.addOneData( |
| | | it.toBaseRealTimeData(BaseRealTimeData::class.java) |
| | | ) |
| | | } |