add new data of param
This commit is contained in:
@@ -22,19 +22,12 @@ class TrafficLightHMIManager {
|
||||
}
|
||||
|
||||
fun updateTrafficLight(trafficLightResult: TrafficLightResult) {
|
||||
//todo 需要确认场景是否一致
|
||||
// if (!initView) {
|
||||
// initView = true
|
||||
// CallerHmiManager.showWarningTrafficLight(0)
|
||||
// }
|
||||
// val leftTrafficLightStatus = trafficLightResult.laneList.left
|
||||
// callerHMIToChangeLight(leftTrafficLightStatus)
|
||||
//
|
||||
// val midTrafficLightStatus = trafficLightResult.laneList.mid
|
||||
// callerHMIToChangeLight(midTrafficLightStatus)
|
||||
//
|
||||
// val rightTrafficLightStatus = trafficLightResult.laneList.right
|
||||
// callerHMIToChangeLight(rightTrafficLightStatus)
|
||||
val currentTrafficLight = trafficLightResult.currentRoadTrafficLight()
|
||||
if (!initView) {
|
||||
initView = true
|
||||
CallerHmiManager.showWarningTrafficLight(0)
|
||||
}
|
||||
callerHMIToChangeLight(currentTrafficLight)
|
||||
}
|
||||
|
||||
private fun callerHMIToChangeLight(trafficLightStatus: TrafficLightStatus) {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.eagle.core.data.trafficlight
|
||||
|
||||
//道路地面要素,转向标识
|
||||
class RoadArrow {
|
||||
|
||||
companion object {
|
||||
private const val STRAIGHT_AHEAD = 201 //直行
|
||||
private const val STRAIGHT_OR_LEFT = 202 //直行左转
|
||||
private const val STRAIGHT_OR_RIGHT = 203 //直行右转
|
||||
private const val STRAIGHT_OR_U_TURN = 204 //直行转向
|
||||
private const val TURN_LEFT = 205 //左转
|
||||
private const val TURN_LEFT_OR_U_TURN = 206 //左转或转向
|
||||
private const val TURN_RIGHT = 206 //右转
|
||||
const val U_TURN = 211 //转向
|
||||
|
||||
fun isLeft(arrowId: Int): Boolean {
|
||||
return arrowId == STRAIGHT_OR_LEFT || arrowId == TURN_LEFT || arrowId == TURN_LEFT_OR_U_TURN
|
||||
}
|
||||
|
||||
fun isStraight(arrowId: Int): Boolean {
|
||||
return arrowId == STRAIGHT_AHEAD || arrowId == STRAIGHT_OR_RIGHT || arrowId == STRAIGHT_OR_U_TURN
|
||||
}
|
||||
|
||||
fun isRight(arrowId: Int): Boolean {
|
||||
return arrowId == TURN_RIGHT || arrowId == STRAIGHT_OR_RIGHT
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,20 @@
|
||||
package com.mogo.eagle.core.data.trafficlight
|
||||
|
||||
fun TrafficLightResult.currentRoadTrafficLight(): TrafficLightStatus {
|
||||
return TrafficLightStatusHelper.getCurrentRoadTrafficLight(this)
|
||||
}
|
||||
|
||||
/**
|
||||
* 路口红绿灯请求返回数据
|
||||
*/
|
||||
class TrafficLightResult(
|
||||
val crossId: String, //roadID
|
||||
val lat: Double, //纬度
|
||||
val lon: Double, //经度
|
||||
val direction: String, //航向角
|
||||
val lightId:Int, //红绿灯ID
|
||||
val laneList: TrafficLightDetail //灯态具体信息
|
||||
val crossId: String, //roadID
|
||||
val lat: Double, //纬度
|
||||
val lon: Double, //经度
|
||||
val direction: String, //航向角
|
||||
val lightId: Int, //红绿灯ID
|
||||
val laneNo: Int, //车道号
|
||||
val arrowNo: Int, //当前车道对应地面要素转向
|
||||
val laneList: TrafficLightDetail //灯态具体信息
|
||||
) {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.eagle.core.data.trafficlight
|
||||
|
||||
object TrafficLightStatusHelper {
|
||||
|
||||
fun getCurrentRoadTrafficLight(trafficLightResult: TrafficLightResult): TrafficLightStatus? {
|
||||
val arrowNo = trafficLightResult.arrowNo
|
||||
if (RoadArrow.isLeft(arrowNo) && trafficLightResult.laneNo == -1) {
|
||||
return trafficLightResult.laneList.left
|
||||
}
|
||||
if (RoadArrow.isStraight(arrowNo) && trafficLightResult.laneNo != -1) {
|
||||
return trafficLightResult.laneList.mid
|
||||
}
|
||||
if (RoadArrow.isRight(arrowNo)) {
|
||||
return trafficLightResult.laneList.right
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -72,7 +72,6 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem
|
||||
@Override
|
||||
public void init(Context context, String appId) {
|
||||
this.mAppId = appId;
|
||||
// TODO 这里出现了ANR异常,需要等 艾兵兵排查问题
|
||||
SocketManager.getInstance().init(context);
|
||||
SocketManager.getInstance().registerSocketConnCallback(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user