Merge branch 'dev_robotaxi-d_240705_6.5.0' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robotaxi-d_240705_6.5.0

This commit is contained in:
aibingbing
2024-07-10 19:17:34 +08:00
58 changed files with 467 additions and 327 deletions

View File

@@ -6,36 +6,26 @@ import android.os.Message
import android.text.TextUtils
import android.util.Log
import androidx.core.util.Pair
import com.google.gson.JsonArray
import com.google.gson.JsonObject
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.CommunicationType
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_TOP
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay
import com.mogo.eagle.core.data.map.entity.MarkerLocation
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType.V2X
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.function.angle.scenes.Default
import com.mogo.eagle.core.function.angle.scenes.RoadEvent
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoV2nNioEventListener
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.hmi.xiaozhi.event.V2N
import com.mogo.eagle.core.function.api.hmi.xiaozhi.state.State
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerV2XListenerManager.V2NCarTypeCheck
import com.mogo.eagle.core.function.call.autopilot.CallerV2nNioEventListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -46,8 +36,7 @@ import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
import com.mogo.eagle.function.biz.v2x.v2n.consts.V2XConst
import com.mogo.eagle.function.biz.v2x.v2n.remove.MarkerWrapper
import com.mogo.eagle.function.biz.v2x.v2n.pnc.beans.Extras
import com.mogo.eagle.function.biz.v2x.v2n.scenario.scene.airoad.AiRoadMarker
import com.mogo.eagle.function.biz.v2x.v2n.scenario.scene.airoad.AiRoadMarker.Marker
import com.mogo.eagle.function.biz.v2x.v2n.utils.EventDismissBean
@@ -57,17 +46,12 @@ import com.mogo.eagle.function.biz.v2x.v2n.utils.V2NUtils
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager
import com.mogo.map.MapDataWrapper
import com.mogo.map.entities.Lane
import com.mogo.map.overlay.core.Level.MAP_MARKER
import com.mogo.map.overlay.point.Point
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.Header
import mogo.telematics.pad.MessagePad.TrackedObject
import mogo.telematics.pad.MessagePad.V2nCrossSpeed
import mogo.v2x.MogoV2X
import mogo.v2x.MogoV2X.RSI_PB
import mogo.v2x.MogoV2X.RTEData_PB
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.TimeUnit.SECONDS
import kotlin.math.abs
/**
@@ -150,7 +134,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
it.location = e.location
it.polygon = polygon
}
}), true, isDrawRoadLine(poiType)
}, isUseGps = true), true, isDrawRoadLine(poiType)
)
val distance = CoordinateUtils.calculateLineDistance(
@@ -174,6 +158,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
)
)
if (polygon.isNotEmpty()) {
val decision = V2NUtils.computeOccupyLanesInfo(Triple(car.longitude, car.latitude, car.heading.toFloat()), Triple(itx.longitude, itx.latitude, itx.heading.toFloat()), polygon.map { kotlin.Pair(it.first, it.second) })
if (decision != null) {
val isDriver = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
@@ -323,31 +308,23 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
V2XBizTrace.onAck(TAG, mapOf("other_retrograde_vehicle" to "event == null"), true)
return@Callback true
}
val body = runCatching { GsonUtils.fromJson(event.exts, Map::class.java) }.getOrNull()
val cameraIp = body?.get("cameraIp") as? String ?: ""
val array = (body?.get("eventExtUnits") as? JsonArray)
val body = runCatching { GsonUtils.fromJson(event.exts, Extras::class.java) }.getOrNull()
val cameraIp = body?.cameraIp
val array = body?.eventExtUnits
var heading = 0.0
var uuid = ""
if (array != null && array.size() > 0) {
if (!array.isNullOrEmpty()) {
for (e in array) {
if (e is JsonObject) {
if (e.has("heading")) {
heading = runCatching { e.asDouble }.getOrNull() ?: 0.0
}
if (e.has("uuid")) {
uuid = runCatching { e.asString }.getOrNull() ?: ""
}
}
heading = e.heading ?: 0.0
uuid = e.uuid ?: ""
}
}
Logger.d(TAG, "cameraIp: $cameraIp, heading:$heading, uuid: $uuid")
val newEventId = "other_retrograde_vehicle_${event.eventId}"
val isUseGps = event.gnssType != 0
val eventLocation = if (isUseGps) arrayOf(event.longitude, event.latitude) else CoordinateTransform.GCJ02ToWGS84(event.longitude, event.latitude)
val carLocation = if (isUseGps) CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() else CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
AiRoadMarker.aiMakers.getOrPut(newEventId) {
val eventLocation = when (event.gnssType) {
0 -> CoordinateTransform.GCJ02ToWGS84(event.longitude, event.latitude)
else -> arrayOf(event.longitude, event.latitude)
}
val carLocation = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
val distance = CoordinateUtils.calculateLineDistance(carLocation.longitude, carLocation.latitude, eventLocation[0], eventLocation[1])
if (distance > 150) {
Logger.i(TAG, "other_retrograde_vehicle --> distance > 150")
@@ -364,11 +341,11 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
isDriver,
String.format(EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_SOCKET_ROAD_OTHER_RETROGRADE_VEHICLE.poiType), distance.toInt()),
cameraIp.toString(),
event.longitude,
event.latitude)
eventLocation[0],
eventLocation[1])
AiRoadMarker()
}.also {
it.marker(Marker(newEventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_OTHER_RETROGRADE_VEHICLE.poiType, event.longitude, event.latitude, 0.0), drawMarker = true, false, isHighFrequency = true)
it.marker(Marker(newEventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_OTHER_RETROGRADE_VEHICLE.poiType, eventLocation[0], eventLocation[1], heading, isUseGps = isUseGps), drawMarker = true, false, isHighFrequency = true)
}.receive()
} else if (msg.what == MSG_WHAT_DRAW_GREEN_WAVE) {
val data = msg.obj as? V2nCrossSpeed ?: return@Callback true
@@ -406,35 +383,31 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
} else if (msg.what == MSG_WHAT_DRAW_PEOPLE_CROSS) {
Logger.i(TAG, "people cross -- 1 --")
val data = msg.obj as? MessagePad.Event ?: return@Callback true
val body = runCatching { GsonUtils.fromJson(data.exts, Map::class.java) }.getOrNull()
val cameraIp = body?.get("cameraIp") as? String ?: ""
val array = (body?.get("eventExtUnits") as? JsonArray)
val body = runCatching { GsonUtils.fromJson(data.exts, Extras::class.java) }.getOrNull()
val cameraIp = body?.cameraIp
val array = body?.eventExtUnits
var heading = 0.0
var uuid = ""
if (array != null && array.size() > 0) {
if (!array.isNullOrEmpty()) {
for (e in array) {
if (e is JsonObject) {
if (e.has("heading")) {
heading = runCatching { e.asDouble }.getOrNull() ?: 0.0
}
if (e.has("uuid")) {
uuid = runCatching { e.asString }.getOrNull() ?: ""
}
}
heading = e.heading ?: 0.0
uuid = e.uuid ?: ""
}
}
Logger.d(TAG, "cameraIp: $cameraIp, heading:$heading, uuid: $uuid")
val isUseGps = data.gnssType != 0
val eventLocation = if (isUseGps) arrayOf(data.longitude, data.latitude) else CoordinateTransform.GCJ02ToWGS84(data.longitude, data.latitude)
val carLocation = if (isUseGps) CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() else CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
val distance = CoordinateUtils.calculateLineDistance(carLocation.longitude, carLocation.latitude, eventLocation[0], eventLocation[1])
AiRoadMarker.aiMakers.getOrPut(data.eventId) {
Logger.i(TAG, "people cross -- 2 --")
val isDriver = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
val carLocation = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
val distance = CoordinateUtils.calculateLineDistance(carLocation.longitude, carLocation.latitude, data.longitude, data.latitude)
if (distance > 150) {
Logger.i(TAG, "people cross --> distance > 150")
V2XBizTrace.onAck(TAG, mapOf("people cross" to "distance > 150"), true)
return@Callback true
}
Logger.i(TAG, "people cross -- 3 --")
val isDriver = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
// 弹事件框
CallerRoadV2NEventWindowListenerManager.showLiveVideo(
data.eventId,
@@ -444,12 +417,12 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
isDriver,
String.format(EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType), distance.toInt()),
cameraIp.toString(),
data.longitude,
data.latitude)
eventLocation[0],
eventLocation[1])
AiRoadMarker()
}.also {
Logger.i(TAG, "people cross -- 4 --")
it.marker(Marker(data.eventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType, data.longitude, data.latitude, heading), drawMarker = true, false, isHighFrequency = true)
it.marker(Marker(data.eventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType, eventLocation[0], eventLocation[1], heading, isUseGps = isUseGps), drawMarker = true, false, isHighFrequency = true)
}.receive()
}
true

View File

@@ -0,0 +1,17 @@
package com.mogo.eagle.function.biz.v2x.v2n.pnc.beans
import androidx.annotation.Keep
@Keep
data class Extras (
val cameraIp: String? = null,
val eventExtUnits: List<EventExtUnit>? = null
)
@Keep
data class EventExtUnit(
val heading: Double? = null,
val uuid: String? = null
)

View File

@@ -107,7 +107,7 @@ class AiRoadMarker {
val builder = getOrPutPointOptionBuilder(markerId, V2XConst.V2X_MARKER_OWNER, MAP_MARKER)
builder
.set3DMode(true)
.isUseGps(true)
.isUseGps(marker.isUseGps)
.icon3DRes(EventTypeEnumNew.getMarker3DRes(marker.poiType))
.anchorColor("#D65D5AFF")
.controlAngle(true)
@@ -122,7 +122,7 @@ class AiRoadMarker {
if (marker.poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_OTHER_RETROGRADE_VEHICLE.poiType) {
distance = 100
}
val wrapper = MarkerWrapper(markerId, marker.poi_lon, marker.poi_lat, 1, elapsedDistance = distance)
val wrapper = MarkerWrapper(markerId, marker.poi_lon, marker.poi_lat, if (marker.isUseGps) 1 else 0, elapsedDistance = distance)
wrapper.onRemoved = {
builders.remove(markerId)
markerIds.remove(p.id)
@@ -153,7 +153,7 @@ class AiRoadMarker {
if (marker.poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_GREE_WAVE.poiType) {
elapsedDuration = TimeUnit.SECONDS.toMillis(3)
}
val wrapper = MarkerWrapper(markerId, marker.poi_lon, marker.poi_lat, 1, elapsedDistance = elapsedDistance, elapsedDuration = elapsedDuration)
val wrapper = MarkerWrapper(markerId, marker.poi_lon, marker.poi_lat, if (marker.isUseGps) 1 else 0, elapsedDistance = elapsedDistance, elapsedDuration = elapsedDuration)
if (drawMarker) {
marker.entity?.apply { roadMarker.drawMarkers(this, wrapper) }
}
@@ -371,6 +371,7 @@ class AiRoadMarker {
val polygon: List<Pair<Double, Double>>? = null,
var farthestPoint: Pair<Double, Double>? = null,
var entity: V2XRoadEventEntity? = null,
var isUseGps: Boolean = false
) {
override fun equals(other: Any?): Boolean {

View File

@@ -47,7 +47,7 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
List<Pair<Double, Double>> polygons = noveltyInfo.getPolygon();
if (gpsLocation != null && polygons != null) {
MarkerLocation location = noveltyInfo.getLocation();
AiRoadMarker.Marker m = new AiRoadMarker.Marker(noveltyInfo.getInfoId(), noveltyInfo.getPoiType(), gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity);
AiRoadMarker.Marker m = new AiRoadMarker.Marker(noveltyInfo.getInfoId(), noveltyInfo.getPoiType(), gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity, false);
AiRoadMarker aiMarker = new AiRoadMarker();
aiMarker.marker(m, true, isDrawRoadLine(m.getPoiType()), false);
AiRoadMarker.aiMakers.put(noveltyInfo.getInfoId(), aiMarker);

View File

@@ -8,6 +8,8 @@ import com.zhidaoauto.map.data.road.CenterLine
import org.locationtech.jts.geom.Coordinate
import org.locationtech.jts.geom.GeometryFactory
import org.locationtech.jts.geom.LineString
import org.locationtech.jts.geom.LineString.MINIMUM_VALID_SIZE
import org.locationtech.jts.geom.Polygon
import org.locationtech.jts.linearref.LengthIndexedLine
import java.util.concurrent.CountDownLatch
@@ -27,8 +29,20 @@ object V2NUtils {
}
val occupy = ArrayList<Lane>()
val factory = GeometryFactory()
val polygonList = ArrayList<Coordinate>(polygon.map { Coordinate(it.first, it.second) })
var p1: Polygon? = null
while (p1 == null) {
if (polygonList.size < MINIMUM_VALID_SIZE) {
polygonList.add(polygonList[0])
continue
}
try {
p1 = factory.createPolygon(polygonList.toTypedArray())
} catch (ignore: IllegalArgumentException) {
polygonList.add(polygonList[0])
}
}
for (lane in lanes) {
val p1 = factory.createPolygon(polygon.map { Coordinate(it.first, it.second) }.toTypedArray())
val p2 = factory.createLineString(lane.points.map { Coordinate(it.first, it.second) }.toTypedArray()).buffer((lane.width.toDouble() * 0.7 * (1e-5)) / 2.0)
if (p1.intersects(p2)) {
occupy += lane

View File

@@ -16,6 +16,7 @@ import com.mogo.eagle.core.data.v2x.V2XEvent.RoadEventX
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setDemoMode
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerV2nNioEventListenerManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
@@ -37,7 +38,9 @@ import io.netty.channel.Channel
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.TrackedObject
import java.nio.charset.Charset
import java.util.Collections
class TeleMsgHandler : IMsgHandler {
@@ -103,6 +106,22 @@ class TeleMsgHandler : IMsgHandler {
}
return
}
if (it.protocolType == TelematicConstant.V2N_AI_ROAD_SHI_GONG) {
runCatching {
Log.d(TAG, "乘客屏收到司机屏转发云端下发的道路施工 --- 1 ---")
CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate(Collections.singletonList(TrackedObject.parseFrom(msg.body)))
Log.d(TAG, "乘客屏收到司机屏转发云端下发的道路施工 --- 2 ---")
}
return
}
if (it.protocolType == TelematicConstant.V2N_AI_ROAD_SHI_GU) {
runCatching {
Log.d(TAG, "乘客屏收到司机屏转发云端下发的道路事故 --- 1 ---")
CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate(Collections.singletonList(TrackedObject.parseFrom(msg.body)))
Log.d(TAG, "乘客屏收到司机屏转发云端下发的道路事故 --- 2 ---")
}
return
}
if (it.protocolType == TelematicConstant.V2N_NEW_LINK_SWITCH) {
try {
Log.d(TAG, "乘客屏收到司机屏转发的新链路开关 --- 1 ---")

View File

@@ -14,6 +14,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.autopilot.AutopilotSummaryInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
@@ -21,6 +22,7 @@ import com.mogo.eagle.core.data.notice.AutoExplorationEntity
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
@@ -125,8 +127,12 @@ class AutomaticExplorationView @JvmOverloads constructor(
}
}
if(allComplete){
//语音播放
AIAssist.getInstance(context).speakTTSVoice("道路畅通一切正常蘑菇型车助手将持续守候您的出行")
//停止左上角扫描动画
rotationAnim?.cancel()
//语音播放,只在司机端播放
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
AIAssist.getInstance(context).speakTTSVoice("道路畅通一切正常蘑菇型车助手将持续守候您的出行")
}
//5秒后关闭弹窗
val hideViewTimer =object: CountDownTimer(EXPLORATION_HIDE_TIME,EXPLORATION_HIDE_TIME){
override fun onTick(millisUntilFinished: Long) {

View File

@@ -128,6 +128,7 @@
android:textSize="@dimen/sp_94"
android:textColor="@color/summary_service_num_p"
app:layout_constraintHorizontal_chainStyle="packed"
android:fontFamily="@font/font_din"
/>
<TextView
@@ -154,6 +155,7 @@
android:textSize="@dimen/sp_94"
android:textColor="@color/summary_service_num_p"
app:layout_constraintHorizontal_chainStyle="packed"
android:fontFamily="@font/font_din"
/>
<TextView
@@ -180,6 +182,7 @@
android:textSize="@dimen/sp_94"
android:textColor="@color/summary_service_num_p"
app:layout_constraintHorizontal_chainStyle="packed"
android:fontFamily="@font/font_din"
/>
<TextView
@@ -206,6 +209,7 @@
android:textSize="@dimen/sp_94"
android:textColor="@color/summary_service_num_p"
app:layout_constraintHorizontal_chainStyle="packed"
android:fontFamily="@font/font_din"
/>
<TextView
@@ -232,6 +236,7 @@
android:textSize="@dimen/sp_94"
android:textColor="@color/summary_service_num_p"
app:layout_constraintHorizontal_chainStyle="packed"
android:fontFamily="@font/font_din"
/>
<TextView
@@ -284,6 +289,7 @@
android:textColor="@color/summary_danger_num_p"
android:textSize="@dimen/sp_195"
android:layout_marginTop="@dimen/dp_120"
android:fontFamily="@font/font_din"
/>
<TextView
@@ -333,6 +339,7 @@
android:textColor="@color/summary_danger_num_p"
android:textSize="@dimen/sp_195"
android:layout_marginTop="@dimen/dp_120"
android:fontFamily="@font/font_din"
/>
<TextView

View File

@@ -21,7 +21,7 @@
android:id="@+id/tvExplorationContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_20"
android:textSize="@dimen/sp_22"
android:textColor="@color/auto_exploration_content_p"
android:layout_marginStart="@dimen/dp_13"
android:layout_gravity="center_vertical"

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_580"
android:layout_height="@dimen/dp_520"
android:background="@drawable/bg_automatic_exploration"
android:layout_width="@dimen/dp_674"
android:layout_height="@dimen/dp_582"
android:background="@drawable/hmi_v2n_event_bg_passenger"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
@@ -13,6 +13,8 @@
app:layout_constraintLeft_toLeftOf="parent"
android:src="@drawable/icon_scan"
android:contentDescription="@string/exploration_scan"
android:layout_marginTop="@dimen/dp_68"
android:layout_marginStart="@dimen/dp_84"
/>
<ImageView
@@ -47,6 +49,8 @@
app:layout_constraintRight_toRightOf="parent"
android:src="@drawable/icon_exploration_close"
android:contentDescription="@string/exploration_close"
android:layout_marginTop="@dimen/dp_68"
android:layout_marginEnd="@dimen/dp_68"
/>
<androidx.recyclerview.widget.RecyclerView

View File

@@ -7,6 +7,7 @@ import android.os.Looper
import android.os.Message
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.road.CameraDeviceInfo
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
@@ -15,6 +16,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84Lis
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.view.CameraMarkerView
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.utilcode.util.ThreadUtils
@@ -30,6 +32,7 @@ class RoadCrossCameraManager : IMoGoMapRoadListener {
companion object {
private const val TAG = "RoadCrossCameraManager"
private const val REQUEST_CAMERA_MSG = 0
private const val REMOVE_MARKER_DELAY_TIME = 10_000L
val instance: RoadCrossCameraManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
@@ -67,7 +70,9 @@ class RoadCrossCameraManager : IMoGoMapRoadListener {
"$M_MAP$TAG",
"触发接口调用 dis: $distance , roadCrossEnd: ${roadCrossEnd ?: "null"} "
)
AIAssist.getInstance(mContext).speakTTSVoice("蘑菇检测到前方${distance.toInt()}米您将通过路口,已为您切换展示路口全息影像")
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
AIAssist.getInstance(mContext).speakTTSVoice("蘑菇检测到前方${distance.toInt()}米您将通过路口,已为您切换展示路口全息影像")
}
if (roadCrossEnd != null) {
ndeRoadCameraNetWorkModel.getRoadCrossInfo(roadCrossEnd,
onSuccess = {
@@ -155,7 +160,10 @@ class RoadCrossCameraManager : IMoGoMapRoadListener {
ndeRoadCameraNetWorkModel.cancelRequest("roadCross")
// 清除marker
CallerLogger.d("$M_MAP$TAG", "remove marker")
handler.sendEmptyMessageDelayed(0, REMOVE_MARKER_DELAY_TIME)
if(handler.hasMessages(REQUEST_CAMERA_MSG)){
handler.removeMessages(REQUEST_CAMERA_MSG)
handler.sendEmptyMessageDelayed(REQUEST_CAMERA_MSG, REMOVE_MARKER_DELAY_TIME)
}
// 释放控制
isCameraRequest = false
CallerLogger.d("$M_MAP$TAG", "经过路口,释放控制")

View File

@@ -4,6 +4,9 @@ import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.content.Context
import android.graphics.Rect
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
@@ -12,11 +15,15 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapIdentifyManager
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.eagle.core.function.map.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.utilcode.util.ThreadUtils
@@ -35,10 +42,12 @@ class RoadCrossRoamView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoMapRoadListener{
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoMapRoadListener, IViewControlListener {
companion object {
const val TAG = "RoadCrossRoamView"
private const val MSG_HIDE_VIEW = 0
private const val MSG_HIDE_VIEW_TIME = 10_000L
}
private var showState by Delegates.observable(false) { _, oldV, newV ->
@@ -51,6 +60,15 @@ class RoadCrossRoamView @JvmOverloads constructor(
private var rotationAnim: ObjectAnimator? = null
private var lightMode = CallerSkinModeListenerManager.getMode() == 1
private val handler = object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
if (msg.what == MSG_HIDE_VIEW) {
detachView()
}
}
}
init {
val res = if (lightMode) {
R.layout.view_road_cross_roam_light
@@ -75,9 +93,17 @@ class RoadCrossRoamView @JvmOverloads constructor(
}
}
override fun mainPageViewVisible(v: Int) {
super.mainPageViewVisible(v)
if (v == View.GONE && this.visibility == View.VISIBLE) {
detachView()
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMapRoadListenerManager.addListener(TAG, this)
CallerHmiViewControlListenerManager.addListener(TAG, this)
}
private fun updateView(state: Boolean) {
@@ -93,11 +119,11 @@ class RoadCrossRoamView @JvmOverloads constructor(
override fun onStopLineInfo(info: StopLine) {
super.onStopLineInfo(info)
if(info.distance == 0.0 || info.distance > 200){
if (info.distance == 0.0 || info.distance > 200) {
CallerLogger.d("$M_MAP$TAG", "showState return , distance is ${info.distance}")
return
}
showState = info.distance <= 200 && info.distance > 100
showState = info.distance in 110.0..200.0
}
private fun attachView() {
@@ -115,7 +141,10 @@ class RoadCrossRoamView @JvmOverloads constructor(
mapRoamView.openRoam()
//播放语音
val dis = CallerMapRoadListenerManager.getStopLineDistance()?.toInt() ?: 0
AIAssist.getInstance(context).speakTTSVoice("前方${dis}米将通过路口,蘑菇为您提供路口全息影像,助力出行")
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
AIAssist.getInstance(context)
.speakTTSVoice("前方${dis}米将通过路口,蘑菇为您提供路口全息影像,助力出行")
}
lvRoadCrossRoamTip.adapter = RoadCrossRoamListAdapter(context, lightMode)
// 创建横向移动的动画
if (animator == null) {
@@ -145,12 +174,16 @@ class RoadCrossRoamView @JvmOverloads constructor(
} else {
tvRoadRoamTitle.setTextColor(context.getColor(R.color.white))
}
handler.sendEmptyMessageDelayed(MSG_HIDE_VIEW, MSG_HIDE_VIEW_TIME)
}
private fun detachView() {
if (this.visibility == View.GONE) {
return
}
if(handler.hasMessages(MSG_HIDE_VIEW)){
handler.removeMessages(MSG_HIDE_VIEW)
}
mapRoamView.closeRoam()
mapRoamView.visibility = View.GONE
CallerMapIdentifyManager.roam = Pair("", false)
@@ -169,6 +202,7 @@ class RoadCrossRoamView @JvmOverloads constructor(
ivZhiRoadRoamView.clearAnimation()
}
CallerMapRoadListenerManager.removeListener(TAG)
CallerHmiViewControlListenerManager.removeListener(TAG)
}
}