Merge remote-tracking branch 'origin/dev_robotaxi-d_250603_8.1.0' into dev_robotaxi-d_250603_8.1.0

This commit is contained in:
xuxinchao
2025-06-20 14:52:36 +08:00
41 changed files with 726 additions and 405 deletions

View File

@@ -10,10 +10,14 @@ import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.och.bridge.autopilot.location.OchLocationManager
import com.mogo.och.bridge.distance.TrajectoryAndDistanceManager
import com.mogo.och.bridge.bridge.OchBridgeManager
import com.mogo.och.bridge.bridge.OchVlmManager
import com.mogo.och.bridge.trajectory.TrajectoryManager
import com.mogo.och.common.module.biz.birdge.BridgeService
import com.mogo.och.common.module.biz.birdge.BridgeListener
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
import com.mogo.och.common.module.biz.birdge.data.VlmData
import com.mogo.och.common.module.constant.OchCommonConst
import com.mogo.och.common.module.manager.EnvManager
/**
@@ -29,7 +33,16 @@ class BridgeProvider : BridgeService, CallerBase<BridgeListener>() {
override fun init(context: Context?) {
this.context = context
OchBridgeManager.load()
// 车前引导线+预测数据
if(EnvManager.isB2Passenger()||EnvManager.isT1T2Passenger()){
OchBridgeManager.load()
}
// if(EnvManager.isT1T2Passenger()){
OchVlmManager.load()
// }
TrajectoryManager.load()
}
@@ -92,5 +105,17 @@ class BridgeProvider : BridgeService, CallerBase<BridgeListener>() {
}
}
fun invokeVlmDataDispatch(vlmData:VlmData){
M_LISTENERS.forEach {
it.value.onVlmDataListener(vlmData)
}
}
fun inVokeNdeData(title: String, desc: String, sortedList: List<RoadMsg>) {
M_LISTENERS.forEach {
it.value.onNdeDataListener(title,desc,sortedList)
}
}
}

View File

@@ -3,13 +3,10 @@ package com.mogo.och.bridge
import android.annotation.SuppressLint
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
import com.mogo.och.common.module.biz.birdge.data.VlmData
import com.mogo.och.common.module.constant.OchCommonConst
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.manager.loop.LoopInfo
import io.reactivex.schedulers.Schedulers
import kotlin.properties.Delegates
object BridgeServiceManager {
@@ -19,52 +16,12 @@ object BridgeServiceManager {
private var bridgeService: BridgeProvider? =
ARouter.getInstance().build(OchCommonConst.BIZ_Bridge).navigation() as BridgeProvider
private var trajectoryTime = 0L
private var predictionTime = 0L
init {
BizLoopManager.setLoopFunction(TAG,
LoopInfo(2, ::checkTimeout, immediately = false, scheduler = Schedulers.io())
)
}
// 是否有车前引导线
private var haveTrajectoryInfo: Boolean by Delegates.observable(false) { _, oldValue, newValue ->
if (oldValue != newValue) {
bridgeService?.invokeTrajectoryHaveDataListener(newValue)
CallerLogger.d(TAG,"haveTrajectoryInfo 发生变化:${newValue}")
}
trajectoryTime = System.currentTimeMillis()
}
// 是否有预测数据
private var havePredictionInfo: Boolean by Delegates.observable(false) { _, oldValue, newValue ->
if (oldValue != newValue) {
bridgeService?.invokePredictionHavaData(newValue)
CallerLogger.d(TAG,"havePredictionInfo 发生变化:${newValue}")
}
predictionTime = System.currentTimeMillis()
}
fun checkTimeout(){
if(System.currentTimeMillis() - trajectoryTime>2_000){
haveTrajectoryInfo = false
CallerLogger.d(TAG,"超时设置为falsehaveTrajectoryInfo ${haveTrajectoryInfo}")
}
if(System.currentTimeMillis() - predictionTime>2_000){
havePredictionInfo = false
CallerLogger.d(TAG,"超时设置为falsehavePredictionInfo ${havePredictionInfo}")
}
}
fun invokePlanningListener(haveTrajectoryInfos:Boolean){
this.haveTrajectoryInfo = haveTrajectoryInfos
bridgeService?.invokeTrajectoryHaveDataListener(haveTrajectoryInfos)
}
fun invokePredictionHaveData(havePredictionInfos:Boolean){
this.havePredictionInfo = havePredictionInfos
bridgeService?.invokePredictionHavaData(havePredictionInfos)
}
fun invokeTrajectoryPoints(trajectoryList: MutableList<MogoLocation>){
@@ -78,4 +35,15 @@ object BridgeServiceManager {
this.bridgeService?.invokeTrajectoryPointAndDistance(trajectoryList, distance)
}
/**
* 分发vmData
*/
fun invokeVlmData(vlmData: VlmData){
this.bridgeService?.invokeVlmDataDispatch(vlmData)
}
fun invokeNdeData(title: String, desc: String, sortedList: List<RoadMsg>) {
this.bridgeService?.inVokeNdeData(title,desc,sortedList)
}
}

View File

@@ -0,0 +1,42 @@
package com.mogo.och.bridge.bridge
data class VlmImageData(val imageSourceTimestamp: Double ,var image: ByteArray?) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as VlmImageData
return imageSourceTimestamp == other.imageSourceTimestamp
}
override fun hashCode(): Int {
return imageSourceTimestamp.hashCode()
}
override fun toString(): String {
return "VlmImageData(imageSourceTimestamp=$imageSourceTimestamp)"
}
}
data class VlmMessageData(val messageSourceTimestamp: Double ,val id:Int?,val message:String?){
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as VlmMessageData
// if (messageSourceTimestamp != other.messageSourceTimestamp) return false
if (id != other.id) return false
return true
}
override fun hashCode(): Int {
var result = messageSourceTimestamp.hashCode()
result = 31 * result + (id ?: 0)
return result
}
}

View File

@@ -4,24 +4,62 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningTrajectoryListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningTrajectoryListenerManager
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.och.bridge.BridgeServiceManager
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.manager.loop.LoopInfo
import io.reactivex.schedulers.Schedulers
import prediction2025.Prediction2025
import mogo.telematics.pad.MessagePad
import kotlin.properties.Delegates
object OchBridgeManager: CallerBase<IMoGoPlanningTrajectoryListener>(),
IMoGoPlanningTrajectoryListener, IMoGoAutopilotIdentifyListener {
object OchBridgeManager: IMoGoPlanningTrajectoryListener, IMoGoAutopilotIdentifyListener {
private val TAG = "${M_OCHCOMMON}OchPlanningListenerManager"
private var trajectoryTime = 0L
private var predictionTime = 0L
fun load(){
CallerPlanningTrajectoryListenerManager.addListener(TAG,this)
CallerAutopilotIdentifyListenerManager.addListener(TAG,this)
BizLoopManager.setLoopFunction(TAG, LoopInfo(2, ::checkTimeout, immediately = false, scheduler = Schedulers.io()))
}
fun release(){
CallerPlanningTrajectoryListenerManager.removeListener(TAG)
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
}
// 是否有车前引导线
private var haveTrajectoryInfo: Boolean by Delegates.observable(false) { _, oldValue, newValue ->
if (oldValue != newValue) {
BridgeServiceManager.invokePlanningListener(newValue)
CallerLogger.d(TAG,"haveTrajectoryInfo 发生变化:${newValue}")
}
trajectoryTime = System.currentTimeMillis()
}
// 是否有预测数据
private var havePredictionInfo: Boolean by Delegates.observable(false) { _, oldValue, newValue ->
if (oldValue != newValue) {
BridgeServiceManager.invokePredictionHaveData(newValue)
CallerLogger.d(TAG,"havePredictionInfo 发生变化:${newValue}")
}
predictionTime = System.currentTimeMillis()
}
fun checkTimeout(){
if(System.currentTimeMillis() - trajectoryTime>2_000){
haveTrajectoryInfo = false
CallerLogger.d(TAG,"超时设置为falsehaveTrajectoryInfo $haveTrajectoryInfo")
}
if(System.currentTimeMillis() - predictionTime>2_000){
havePredictionInfo = false
CallerLogger.d(TAG,"超时设置为falsehavePredictionInfo $havePredictionInfo")
}
}
/**
@@ -29,17 +67,20 @@ object OchBridgeManager: CallerBase<IMoGoPlanningTrajectoryListener>(),
*/
override fun onAutopilotTrajectory(trajectoryInfos: MutableList<MessagePad.TrajectoryPoint>) {
if(trajectoryInfos.isEmpty()){
BridgeServiceManager.invokePlanningListener(false)
haveTrajectoryInfo = false
}else{
BridgeServiceManager.invokePlanningListener(true)
haveTrajectoryInfo = true
}
}
/**
* 预测信息
*/
override fun onPredictionObstacleTrajectory(predictionObjects: Prediction2025.mPredictionObjects) {
if (predictionObjects.objsAppList==null) {
BridgeServiceManager.invokePredictionHaveData(false)
havePredictionInfo = false
}else{
BridgeServiceManager.invokePredictionHaveData(true)
havePredictionInfo = true
}
}

View File

@@ -1,24 +1,28 @@
package com.mogo.och.unmanned.passenger.ui.aiview
package com.mogo.och.bridge.bridge
import androidx.lifecycle.ViewModel
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.och.unmanned.passenger.ui.aiview.bean.AIMessage
import com.mogo.eagle.core.function.call.autopilot.CallerVlmManager
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.och.bridge.BridgeServiceManager
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
import mogo.telematics.pad.MessagePad.TrackedObject
class NDEViewModel: ViewModel(), IMoGoAutopilotIdentifyListener {
object OchNdeManager : IMoGoAutopilotIdentifyListener {
private val TAG = "${M_OCHCOMMON}OchVlmManager"
companion object{
private const val TAG = "NDEViewModel"
fun load(){
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
}
fun release(){
CallerVlmManager.removeListener(TAG)
}
private var lastMap2 = HashMap<Int, String>()
private var lastTime = 0L
fun init(){
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
}
override fun onAutopilotIdentifyDataUpdate(trafficData: List<TrackedObject>?){
super.onAutopilotIdentifyDataUpdate(trafficData)
handleCheLong(trafficData)
@@ -27,7 +31,7 @@ class NDEViewModel: ViewModel(), IMoGoAutopilotIdentifyListener {
private fun handleCheLong(trafficData: List<TrackedObject>?) {
var hasCheLong = false
var isNewData = false
val roadMsgList = ArrayList<AIMessage.RoadMsg>()
val roadMsgList = ArrayList<RoadMsg>()
val curMap = HashMap<Int, String>()
if (lastTime > 0 && System.currentTimeMillis() - lastTime > 60000) {
lastMap2.clear()// 清除上次车龙事件的缓存
@@ -55,8 +59,7 @@ class NDEViewModel: ViewModel(), IMoGoAutopilotIdentifyListener {
curMap[obj.laneNum] = "0"
}
// 保存所有车道信息
roadMsgList.add(
AIMessage.RoadMsg(
roadMsgList.add(RoadMsg(
obj.arrowType,
laneNum = obj.laneNum,
isRecommend = obj.suggestedLanes,
@@ -74,10 +77,8 @@ class NDEViewModel: ViewModel(), IMoGoAutopilotIdentifyListener {
lastTime = System.currentTimeMillis()
val sortedList = roadMsgList.sortedWith(compareByDescending { it.laneNum })
val ndeEvent = AIMessage.NDEData(System.currentTimeMillis().toString(),"路口车龙","前方路口有车龙",sortedList)
AIMessageManager.post(ndeEvent)
BridgeServiceManager.invokeNdeData("路口车龙","前方路口有车龙",sortedList)
}
}
}
}

View File

@@ -0,0 +1,58 @@
package com.mogo.och.bridge.bridge
import com.mogo.eagle.core.function.api.autopilot.IVlmListener
import com.mogo.eagle.core.function.call.autopilot.CallerVlmManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.och.bridge.BridgeServiceManager
import com.mogo.och.common.module.biz.birdge.data.VlmData
import vllm.Vlm
import kotlin.properties.Delegates
object OchVlmManager : IVlmListener {
private val TAG = "${M_OCHCOMMON}OchVlmManager"
fun load(){
CallerVlmManager.addListener(TAG,this)
}
fun release(){
CallerVlmManager.removeListener(TAG)
}
//
private var vllmImageData: VlmImageData by Delegates.observable(VlmImageData(0.0,null)) { _, oldValue, newValue ->
if (oldValue != newValue) {
if(newValue.imageSourceTimestamp == vllmData.messageSourceTimestamp){
CallerLogger.d(TAG," message先来 图片后来 发送message和图片 ${newValue.imageSourceTimestamp}---${vllmData.messageSourceTimestamp}")
BridgeServiceManager.invokeVlmData(VlmData(vllmData.id,vllmData.message,newValue.image))
}
}
}
private var vllmData: VlmMessageData by Delegates.observable(VlmMessageData(0.0,0,"")) { _, oldValue, newValue ->
if (oldValue != newValue) {
if(newValue.messageSourceTimestamp== vllmImageData.imageSourceTimestamp){
// 图片先来 发送message和图片
BridgeServiceManager.invokeVlmData(VlmData(newValue.id,newValue.message,
vllmImageData.image)
)
CallerLogger.d(TAG,"messsage后来 图片先来 发送message和图片 ${newValue.message}----${newValue.messageSourceTimestamp}---${newValue.id}")
}else{
// message 先来 单独发送message 图片来了后 再次发送出去
BridgeServiceManager.invokeVlmData(VlmData(newValue.id,newValue.message,null))
CallerLogger.d(TAG,"message先来 图片后来 发送message ${newValue.message}---${newValue.messageSourceTimestamp}---${newValue.id}")
}
}
}
override fun onVllm(sourceTimestamp: Double, vllm: Vlm.VLLMObject) {
if(this.vllmData.id!=vllm.workZone.id){
this.vllmData = VlmMessageData(sourceTimestamp,vllm.workZone.id,vllm.workZone.sceneExplantion)
}
}
override fun onVllmImage(sourceTimestamp: Double, image: ByteArray) {
this.vllmImageData = VlmImageData(sourceTimestamp,image)
}
}

View File

@@ -1,6 +1,8 @@
package com.mogo.och.common.module.debug
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.os.Environment
import android.os.SystemClock
import chassis.Chassis
@@ -8,6 +10,7 @@ import chassis.Chassis.DoorNumber
import chassis.VehicleStateOuterClass
import com.amap.api.maps.model.LatLng
import com.google.gson.reflect.TypeToken
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.map.MogoLocation
@@ -24,6 +27,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02Lis
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerVlmManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapRomaListener
@@ -34,24 +38,25 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.ActivityUtils
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.och.common.module.R
import com.mogo.och.common.module.biz.birdge.BridgeManager
import com.mogo.och.common.module.biz.order.OrderManager
import com.mogo.och.common.module.debug.location.MogoLocationExit
import com.mogo.och.common.module.manager.loop.BizLoopManager
//import com.mogo.och.bridge.distance.TrajectoryAndDistanceManager
//import com.mogo.och.bridge.utils.CoordinateCalculateRouteUtil
//import com.mogo.och.bridge.utils.CoordinateCalculateRouteUtil
import com.mogo.och.common.module.view.DebugFloatWindow
import com.mogo.och.common.module.wigets.media.MediaBeanManager
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import vllm.Vlm
import java.io.BufferedReader
import java.io.ByteArrayOutputStream
import java.io.File
import java.io.FileInputStream
import java.io.IOException
import java.io.InputStreamReader
object DebugDataDispatch {
const val TAG = "DebugDataDispatch"
@@ -73,6 +78,8 @@ object DebugDataDispatch {
const val ota = "ota"
const val video = "video"
const val mediaMusic = "mediaAndMusic"
const val vlmMessage = "vlmMessage"
const val vlmImage = "vlmImage"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "location" --es path "1111/11111"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "globalPath" --es path "sy73.json"
@@ -89,7 +96,8 @@ object DebugDataDispatch {
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "showDebugView"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "scanner" --es qrInfo ""
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "ota" --ei "ota" 1
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "video" --ei "video" 1 --es url "rtmp://video.zhidaozhixing.com/live/861130041693196C_2"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "vlmMessage" --es message "前方100米有道路施工施工长度100米影响第1、2车道通行。" --ei id 128 --ef time 1880.0
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "vlmImage" --ef time 1880.0
val ROOT_PATH =
@@ -102,6 +110,25 @@ object DebugDataDispatch {
}
when (type) {
vlmMessage -> {
val time = intent.getFloatExtra("time",0f)
val id = intent.getIntExtra("id",0)
val message = intent.getStringExtra("message")
val newBuilder = Vlm.VLLMObject.newBuilder()
val build = newBuilder.workZoneBuilder.setId(id).setSceneExplantion(message).build()
newBuilder.workZone = build
CallerVlmManager.invokeVllm(time.toDouble(),newBuilder.build())
}
vlmImage -> {
val time = intent.getFloatExtra("time",0f)
BizLoopManager.runInIoThread{
val bitmap = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.common_debug)
val stream = ByteArrayOutputStream()
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream)
val byteArray = stream.toByteArray()
CallerVlmManager.invokeVllmImage(time.toDouble(),byteArray)
}
}
mediaMusic -> {
val musicList = MediaBeanManager.getMusicList()
val mediaList = MediaBeanManager.getMediaList()

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

View File

@@ -1,6 +1,8 @@
package com.mogo.och.common.module.biz.birdge
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
import com.mogo.och.common.module.biz.birdge.data.VlmData
interface BridgeListener {
/**
@@ -15,4 +17,9 @@ interface BridgeListener {
fun onTrajectoryDistanceListener(distance: Double){}
fun onTrajectoryPointsAndDistanceListener(trajectoryList: MutableList<MogoLocation>,distance: Double){}
fun onVlmDataListener(vlmData: VlmData){}
fun onNdeDataListener(title: String, desc: String, sortedList: List<RoadMsg>) {}
}

View File

@@ -0,0 +1,8 @@
package com.mogo.och.common.module.biz.birdge.data
data class RoadMsg(
var arrowType: Int, // 车道类型如直行201(详情参考文件message_pad.proto)
var laneNum: Int,// 车道号
var isRecommend: Boolean,// 是否是推荐车道
var isCheLong: Boolean// 是否有车龙,代表拥堵、行驶缓慢
)

View File

@@ -0,0 +1,28 @@
package com.mogo.och.common.module.biz.birdge.data
data class VlmData(val id:Int?,val message:String?,var image: ByteArray?) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as VlmData
if (id != other.id) return false
if (message != other.message) return false
if (image != null) {
if (other.image == null) return false
if (!image.contentEquals(other.image)) return false
} else if (other.image != null) return false
return true
}
override fun hashCode(): Int {
return id ?: 0
}
override fun toString(): String {
return "VlmData(id=$id, message=$message)"
}
}

View File

@@ -0,0 +1,45 @@
package com.mogo.och.common.module.manager
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
object EnvManager {
fun isB1(): Boolean {
return AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)
}
fun isB1Driver(): Boolean {
return isB1() && AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
}
fun isB1Passenger(): Boolean {
return isB1() && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
}
fun isB2(): Boolean {
return AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)
}
fun isB2Driver(): Boolean {
return isB2() && AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
}
fun isB2Passenger(): Boolean {
return isB2() && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
}
fun isT1T2(): Boolean {
return AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)
}
fun isT1T2Driver(): Boolean {
return isT1T2() && AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
}
fun isT1T2Passenger(): Boolean {
return isT1T2() && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
}
}

View File

@@ -10,6 +10,7 @@ import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.UriUtils
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
import com.mogo.och.common.module.biz.media.MediaManager
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.manager.transform.OchTransform
@@ -126,11 +127,11 @@ class PM2BaseFragment :
CallerMapRoadListenerManager.invokeCrossDevice(true)
}
test3.onClick {
val one = AIMessage.RoadMsg(201,1,true,false)
val two = AIMessage.RoadMsg(202,2,false,false)
val three = AIMessage.RoadMsg(203,3,false,true)
val one = RoadMsg(201,1,true,false)
val two = RoadMsg(202,2,false,false)
val three = RoadMsg(203,3,false,true)
val sortedList = ArrayList<AIMessage.RoadMsg>()
val sortedList = ArrayList<RoadMsg>()
sortedList.add(one)
sortedList.add(two)
sortedList.add(three)

View File

@@ -10,14 +10,14 @@ import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
import com.mogo.och.shuttle.weaknet.passenger.R
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.AIMessage
class AINDERoadAdapter(private val context: Context): RecyclerView.Adapter<AINDERoadAdapter.AIRoadHolder>() {
private var roadList: List<AIMessage.RoadMsg>?= null
private var roadList: List<RoadMsg>?= null
fun setData(list: List<AIMessage.RoadMsg>){
fun setData(list: List<RoadMsg>){
roadList = list
notifyDataSetChanged()
}

View File

@@ -3,6 +3,8 @@ package com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean
import android.os.CountDownTimer
import android.util.Log
import com.mogo.eagle.core.data.v2x.RoadV2NEventType
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
import com.mogo.och.common.module.biz.birdge.data.VlmData
import kotlin.math.floor
@@ -175,11 +177,11 @@ sealed class AIMessage(
var roadList: List<RoadMsg>
): AIMessage(id,title)
data class RoadMsg(
var arrowType: Int, // 车道类型如直行201(详情参考文件message_pad.proto)
var laneNum: Int,// 车道号
var isRecommend: Boolean,// 是否是推荐车道
var isCheLong: Boolean// 是否有车龙,代表拥堵、行驶缓慢
)
data class AiVlmData(
override val id: String,
override val title: String,
var desc: String,
var vlmData: VlmData
):AIMessage(id,title)
}

View File

@@ -3,85 +3,33 @@ package com.mogo.och.shuttle.weaknet.passenger.ui.mind.data
import androidx.lifecycle.ViewModel
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.och.common.module.biz.birdge.BridgeListener
import com.mogo.och.common.module.biz.birdge.BridgeManager
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.AIMessageManager
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.AIMessage
import mogo.telematics.pad.MessagePad.TrackedObject
/**
* 车龙信息
*/
class NDEViewModel: ViewModel(), IMoGoAutopilotIdentifyListener {
class NDEViewModel: ViewModel(), BridgeListener {
companion object{
private const val TAG = "NDEViewModel"
}
private var lastMap2 = HashMap<Int, String>()
private var lastTime = 0L
fun init(){
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
BridgeManager.addBridgeListener(TAG,this)
}
override fun onAutopilotIdentifyDataUpdate(trafficData: List<TrackedObject>?){
super.onAutopilotIdentifyDataUpdate(trafficData)
handleCheLong(trafficData)
override fun onCleared() {
super.onCleared()
BridgeManager.removeBridgeListener(TAG)
}
private fun handleCheLong(trafficData: List<TrackedObject>?) {
var hasCheLong = false
var isNewData = false
val roadMsgList = ArrayList<AIMessage.RoadMsg>()
val curMap = HashMap<Int, String>()
if (lastTime > 0 && System.currentTimeMillis() - lastTime > 60000) {
lastMap2.clear()// 清除上次车龙事件的缓存
}
var lastLocStr: String? = ""
trafficData?.forEach { obj ->
if (obj.type == 707) {// 当前方向所有车道
if (obj.polygonCount > 1) {// 当次数据有车龙事件
lastLocStr = lastMap2[obj.laneNum]
// 1. 上次无车龙但此次有车龙,认为是新车龙事件
// 2. 两次都有车龙,则判断车龙的长度是否相同
if (lastLocStr == null || lastLocStr == "0" || lastLocStr != "${obj.polygonList[0]}-${obj.polygonList[obj.polygonCount - 1]}") {
isNewData = true
}
hasCheLong = true
// key: 车道号value: 非0代表有车龙且首、尾两个点可计算车龙长度
curMap[obj.laneNum] =
"${obj.polygonList[0]}-${obj.polygonList[obj.polygonCount - 1]}"
} else {// 当次没有车龙
if (lastMap2[obj.laneNum] != null && lastMap2[obj.laneNum] != "0") {// 3. 上次有车龙,这次无车龙
isNewData = true
}
// key: 车道号value: 0代表无车龙
curMap[obj.laneNum] = "0"
}
// 保存所有车道信息
roadMsgList.add(
AIMessage.RoadMsg(
obj.arrowType,
laneNum = obj.laneNum,
isRecommend = obj.suggestedLanes,
isCheLong = obj.polygonCount > 1
)
)
}
}
if (isNewData) {
// 清除上次车道信息
lastMap2.clear()
if (hasCheLong) {
// 缓存当次车龙事件所有车道信息
lastMap2.putAll(curMap)
lastTime = System.currentTimeMillis()
val sortedList = roadMsgList.sortedWith(compareByDescending { it.laneNum })
val ndeEvent = AIMessage.NDEData(System.currentTimeMillis().toString(),"路口车龙","前方路口有车龙",sortedList)
AIMessageManager.post(ndeEvent)
}
}
override fun onNdeDataListener(title: String, desc: String, sortedList: List<RoadMsg>) {
val ndeEvent = AIMessage.NDEData(System.currentTimeMillis().toString(),title,desc,sortedList)
AIMessageManager.post(ndeEvent)
}
}

View File

@@ -45,6 +45,7 @@
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.eagle.core.function.hmi.ui.msgbox.BusPassengerMsgBoxBubbleView
android:id="@+id/bpmsgBubble"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
@@ -61,6 +62,16 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<com.mogo.eagle.core.function.hmi.ui.v2n.RoadV2NEventWindowView
android:id="@+id/roadV2NEventWindowView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="-70dp"
android:layout_marginRight="14dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bpmsgBubble"
android:visibility="gone"/>
<com.mogo.och.common.module.wigets.LoadingMapStatusView
android:layout_width="match_parent"
android:layout_height="match_parent"/>

View File

@@ -26,6 +26,10 @@ import com.mogo.och.unmanned.passenger.ui.aiview.adapter.AIMessageAdapter
import com.mogo.och.unmanned.passenger.ui.aiview.adapter.OnItemClickListener
import com.mogo.och.unmanned.passenger.ui.aiview.adapter.PaddingItemDecoration
import com.mogo.och.unmanned.passenger.ui.aiview.bean.AIMessage
import com.mogo.och.unmanned.passenger.ui.aiview.data.AutomaticExplorationViewModel
import com.mogo.och.unmanned.passenger.ui.aiview.data.NDEViewModel
import com.mogo.och.unmanned.passenger.ui.aiview.data.RoadCrossRoamViewModel
import com.mogo.och.unmanned.passenger.ui.aiview.data.RoadV2NEventViewModel
import com.mogo.och.unmanned.taxi.passenger.R
import kotlinx.android.synthetic.main.taxt_p_ai.view.aiMotionLayout
import kotlinx.android.synthetic.main.taxt_p_ai.view.ivIcon
@@ -47,11 +51,10 @@ class AiView @JvmOverloads constructor(
private var viewModel:AIViewModel?=null
// private var pncActionsModel:PNCActionsViewModel ?= null
private var roadV2NEventModel:RoadV2NEventViewModel ?= null
private var roadCrossRoamModel:RoadCrossRoamViewModel ?= null
private var automaticExplorationModel:AutomaticExplorationViewModel ?= null
private var ndeViewModel: NDEViewModel ?= null
private var roadV2NEventModel: RoadV2NEventViewModel?= null
private var roadCrossRoamModel: RoadCrossRoamViewModel?= null
private var automaticExplorationModel: AutomaticExplorationViewModel?= null
private var ndeViewModel: NDEViewModel?= null
private var aiAnimator: BigFrameAnimatorContainer?=null
private var aiAnimatorBg: BigFrameAnimatorContainer?=null
@@ -105,7 +108,6 @@ class AiView @JvmOverloads constructor(
if(aiAnimator==null) {
aiAnimator = BigFrameAnimatorContainer(R.array.ai_animator, 31, ivIcon)
}
// aiAnimator?.start()
ivIcon.onClick {
viewModel?.onWakeUp()

View File

@@ -26,6 +26,7 @@ class AIMessageAdapter : ListAdapter<AIMessage, MessageViewHolder>(MessageDiffCa
AIMessage.TYPE_AUTOMATIC_EXPLORATION -> AutomaticExplorationViewHolder(inflater.inflate(R.layout.item_ai_automatic_exploration,parent,false))
AIMessage.TYPE_EVALUATE -> EvaluateViewViewHolder(inflater.inflate(R.layout.taxi_p_evaluate,parent,false))
AIMessage.TYPE_NDE -> NDEViewHolder(inflater.inflate(R.layout.item_ai_nde_event,parent,false))
AIMessage.TYPE_VLM -> VlmViewHolder(inflater.inflate(R.layout.item_ai_vlm_action,parent,false))
else -> throw IllegalArgumentException("Invalid view type")
}
}
@@ -44,6 +45,7 @@ class AIMessageAdapter : ListAdapter<AIMessage, MessageViewHolder>(MessageDiffCa
is AIMessage.AutomaticExploration -> AIMessage.TYPE_AUTOMATIC_EXPLORATION
is AIMessage.EvaluateData -> AIMessage.TYPE_EVALUATE
is AIMessage.NDEData -> AIMessage.TYPE_NDE
is AIMessage.AiVlmData -> AIMessage.TYPE_VLM
else -> AIMessage.TYPE_EVENT
}
}

View File

@@ -6,7 +6,6 @@ import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.content.Context
import android.graphics.Rect
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.view.animation.LinearInterpolator
@@ -14,6 +13,7 @@ import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.widget.AppCompatImageView
import androidx.core.content.ContextCompat
import androidx.core.graphics.toColorInt
import androidx.recyclerview.widget.LinearLayoutManager
@@ -28,7 +28,9 @@ import com.mogo.eagle.core.function.hmi.ui.v2n.RoadV2NEventLivePlayView
import com.mogo.eagle.core.function.view.MapRoamView
import com.mogo.eagle.core.function.view.RoadCrossRoamListAdapter
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.utilcode.mogo.glide.GlideImageLoader
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
import com.mogo.och.common.module.utils.FrameAnimatorContainer
@@ -38,8 +40,6 @@ import com.mogo.och.unmanned.taxi.passenger.R
import com.youth.banner.Banner
import com.youth.banner.indicator.CircleIndicator
import com.youth.banner.transformer.ScaleInTransformer
import kotlinx.android.synthetic.main.taxi_p_evaluate.view.iv_evaluate_great
import kotlinx.android.synthetic.main.taxi_p_evaluate.view.iv_evaluate_low
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
@@ -85,6 +85,23 @@ abstract class MessageViewHolder(view: View) : RecyclerView.ViewHolder(view) {
.placeholder(R.drawable.icon_pic_holder)
.error(R.drawable.icon_pic_error)
// .error(R.drawable.icon_marker_window_place_holder)
// .placeholder(R.drawable.icon_marker_window_place_holder)
.into(this)
}
}
fun ImageView.showOrHideWithByteArray(image: ByteArray?) {
if (image==null) {
visibility = View.GONE
} else {
visibility = View.VISIBLE
//optionalTransform(new GlideRoundedCornersTransform(30f, GlideRoundedCornersTransform.CornerType.LEFT))
Glide.with(this)
.load(image)
.optionalTransform(GlideRoundedCornersTransform(18f, GlideRoundedCornersTransform.CornerType.ALL))
.placeholder(R.drawable.icon_pic_holder)
.error(R.drawable.icon_pic_error)
// .error(R.drawable.icon_marker_window_place_holder)
// .placeholder(R.drawable.icon_marker_window_place_holder)
.into(this)
@@ -434,6 +451,21 @@ class NDEViewHolder(binding: View) : MessageViewHolder(binding){
}
class VlmViewHolder(binding: View) : MessageViewHolder(binding){
private var tvNdeTitle: TextView = binding.findViewById(R.id.tvVlmMessage)
private var acivVlmImage: AppCompatImageView = binding.findViewById(R.id.acivVlmImage)
override fun bind(item: AIMessage, onItemClickListener: OnItemClickListener?) {
if(item is AIMessage.AiVlmData){
tvNdeTitle.text = item.vlmData.message
acivVlmImage.showOrHideWithByteArray(item.vlmData.image)
}
}
}
private class NoScrollLayoutManager(context: Context?) : LinearLayoutManager(context) {
override fun canScrollVertically(): Boolean {
return false

View File

@@ -10,14 +10,14 @@ import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.mogo.och.unmanned.passenger.ui.aiview.bean.AIMessage
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
import com.mogo.och.unmanned.taxi.passenger.R
class AINDERoadAdapter(private val context: Context): RecyclerView.Adapter<AINDERoadAdapter.AIRoadHolder>() {
private var roadList: List<AIMessage.RoadMsg>?= null
private var roadList: List<RoadMsg>?= null
fun setData(list: List<AIMessage.RoadMsg>){
fun setData(list: List<RoadMsg>){
roadList = list
notifyDataSetChanged()
}

View File

@@ -3,6 +3,8 @@ package com.mogo.och.unmanned.passenger.ui.aiview.bean
import android.os.CountDownTimer
import android.util.Log
import com.mogo.eagle.core.data.v2x.RoadV2NEventType
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
import com.mogo.och.common.module.biz.birdge.data.VlmData
import kotlin.math.floor
@@ -27,6 +29,7 @@ sealed class AIMessage(
const val TYPE_AUTOMATIC_EXPLORATION = 9
const val TYPE_EVALUATE = 10
const val TYPE_NDE = 11
const val TYPE_VLM = 12
}
data class Scan(
@@ -177,11 +180,11 @@ sealed class AIMessage(
var roadList: List<RoadMsg>
):AIMessage(id,title)
data class RoadMsg(
var arrowType: Int, // 车道类型如直行201(详情参考文件message_pad.proto)
var laneNum: Int,// 车道号
var isRecommend: Boolean,// 是否是推荐车道
var isCheLong: Boolean// 是否有车龙,代表拥堵、行驶缓慢
)
data class AiVlmData(
override val id: String,
override val title: String,
var desc: String,
var vlmData: VlmData
):AIMessage(id,title)
}

View File

@@ -1,4 +1,4 @@
package com.mogo.och.unmanned.passenger.ui.aiview
package com.mogo.och.unmanned.passenger.ui.aiview.data
import android.os.CountDownTimer
import androidx.lifecycle.ViewModel
@@ -10,11 +10,11 @@ import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.utilcode.util.StringUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.bridge.distance.IDistanceListener
import com.mogo.och.bridge.distance.TrajectoryAndDistanceManager
import com.mogo.och.data.taxi.BaseOrderBean
import com.mogo.och.data.taxi.TaxiOrderStatusEnum
import com.mogo.och.unmanned.passenger.ui.aiview.AIMessageManager
import com.mogo.och.unmanned.passenger.ui.aiview.bean.AIMessage
import com.mogo.och.unmanned.taxi.utils.order.OrderListener
import com.mogo.och.unmanned.taxi.utils.order.OrderModel

View File

@@ -0,0 +1,39 @@
package com.mogo.och.unmanned.passenger.ui.aiview.data
import androidx.lifecycle.ViewModel
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.och.common.module.biz.birdge.BridgeListener
import com.mogo.och.common.module.biz.birdge.BridgeManager
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
import com.mogo.och.common.module.biz.birdge.data.VlmData
import com.mogo.och.unmanned.passenger.ui.aiview.AIMessageManager
import com.mogo.och.unmanned.passenger.ui.aiview.bean.AIMessage
class NDEViewModel: ViewModel(), BridgeListener {
companion object{
private const val TAG = "NDEViewModel"
}
fun init(){
BridgeManager.addBridgeListener(TAG,this)
}
override fun onCleared() {
super.onCleared()
BridgeManager.removeBridgeListener(TAG)
}
override fun onVlmDataListener(vlmData: VlmData){
val ndeEvent = AIMessage.AiVlmData(vlmData.id.toString(),"","",vlmData)
AIMessageManager.post(ndeEvent)
}
override fun onNdeDataListener(title: String, desc: String, sortedList: List<RoadMsg>) {
val ndeEvent = AIMessage.NDEData(System.currentTimeMillis().toString(),title,desc,sortedList)
AIMessageManager.post(ndeEvent)
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.och.unmanned.passenger.ui.aiview
package com.mogo.och.unmanned.passenger.ui.aiview.data
import androidx.lifecycle.ViewModel
import com.mogo.eagle.core.data.autopilot.pnc.PncActionsHelper
@@ -6,10 +6,9 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsL
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.unmanned.passenger.model.TaxiPassengerModel
import com.mogo.och.unmanned.passenger.ui.aiview.AIMessageManager
import com.mogo.och.unmanned.passenger.ui.aiview.bean.AIMessage
import mogo.telematics.pad.MessagePad

View File

@@ -1,7 +1,6 @@
package com.mogo.och.unmanned.passenger.ui.aiview
package com.mogo.och.unmanned.passenger.ui.aiview.data
import android.content.Context
import android.view.View
import androidx.lifecycle.ViewModel
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.config.FunctionBuildConfig
@@ -14,6 +13,7 @@ import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.unmanned.passenger.ui.aiview.AIMessageManager
import com.mogo.och.unmanned.passenger.ui.aiview.bean.AIMessage
class RoadCrossRoamViewModel: ViewModel(), IMoGoMapRoadListener {
@@ -67,7 +67,7 @@ class RoadCrossRoamViewModel: ViewModel(), IMoGoMapRoadListener {
AIAssist.getInstance(mContext).speakTTSVoiceWithLevel(disStr, AIAssist.NEW_LEVEL_2)
}
CallerServicesEventManager.updateServicesNum(CallerServicesEventManager.ServiceType.ROAD)
AIMessageManager.post(AIMessage.RoadCrossRoam(System.currentTimeMillis().toString(),""))
AIMessageManager.post(AIMessage.RoadCrossRoam(System.currentTimeMillis().toString(), ""))
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.och.unmanned.passenger.ui.aiview
package com.mogo.och.unmanned.passenger.ui.aiview.data
import androidx.lifecycle.ProcessLifecycleOwner
import androidx.lifecycle.ViewModel
@@ -11,6 +11,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.och.unmanned.passenger.ui.aiview.AIMessageManager
import com.mogo.och.unmanned.passenger.ui.aiview.bean.AIMessage
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/dp_799"
android:layout_height="wrap_content"
app:shadowRadius="@dimen/dp_20"
app:shadowColor="#26666666"
app:xOffset="0dp"
app:yOffset="0dp"
app:blurRadius="@dimen/dp_26">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="@dimen/dp_747"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tvVlmMessage"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@+id/acivVlmImage"
android:textSize="@dimen/dp_33"
android:textColor="@color/taxi_cp_394047"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginEnd="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_27"
android:layout_marginBottom="@dimen/dp_20"
tools:text="前方100米有道路施工施工长度100米影响第1、2车道通行。"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/acivVlmImage"
app:layout_constraintTop_toBottomOf="@+id/tvVlmMessage"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginEnd="@dimen/dp_30"
android:layout_marginBottom="@dimen/dp_27"
android:scaleType="fitXY"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:src="@drawable/icon_image_holder"
tools:background="@color/taxi_cp_394047"
android:layout_width="@dimen/dp_0"
android:layout_height="@dimen/dp_440"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>

View File

@@ -1456,29 +1456,29 @@ class MoGoAdasListenerImpl : OnAdasListener {
*/
override fun onNodeStateInfo(stateInfo: NodeStateInfo) {
CallerNodeStateListenerManager.invokeNodeState(stateInfo)
if (stateInfo.existState != null) {
if (stateInfo.nodeName == AdasConstants.NodeName.SSM) {
//域控SSM接口接收是否超时
if (stateInfo.existState == NodeExistState.NODE_EXIST_TIMEOUT) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.SSMINFO,
SSMMsg(0, "连接超时", "SSM超时无响应", System.currentTimeMillis())
)
)
} else {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.SSMINFO,
SSMMsg(0, "连接恢复", "SSM连接恢复", System.currentTimeMillis())
)
)
}
} else if (stateInfo.nodeName == AdasConstants.NodeName.FSM2024) {
//域控FSM接口接收是否超时
// (stateInfo.existState == NodeExistState.NODE_EXIST_TIMEOUT)
}
}
// if (stateInfo.existState != null) {
// if (stateInfo.nodeName == AdasConstants.NodeName.SSM) {
// //域控SSM接口接收是否超时
// if (stateInfo.existState == NodeExistState.NODE_EXIST_TIMEOUT) {
// CallerMsgBoxManager.saveMsgBox(
// MsgBoxBean(
// MsgBoxType.SSMINFO,
// SSMMsg(0, "连接超时", "SSM超时无响应", System.currentTimeMillis())
// )
// )
// } else {
// CallerMsgBoxManager.saveMsgBox(
// MsgBoxBean(
// MsgBoxType.SSMINFO,
// SSMMsg(0, "连接恢复", "SSM连接恢复", System.currentTimeMillis())
// )
// )
// }
// } else if (stateInfo.nodeName == AdasConstants.NodeName.FSM2024) {
// //域控FSM接口接收是否超时
//// (stateInfo.existState == NodeExistState.NODE_EXIST_TIMEOUT)
// }
// }
}
/**

View File

@@ -44,7 +44,7 @@ public abstract class BaseAdapter<D, VH extends BaseViewHolder> extends Recycler
public void setData(List<D> mDatas) {
this.mDatas = mDatas;
if (!mDatas.isEmpty())
if (mDatas != null && !mDatas.isEmpty())
notifyDataSetChanged();
}

View File

@@ -26,7 +26,6 @@ class NetworkUtilsExtend {
fun onLinkChanged(network: Network?, linkProperties: LinkProperties?)
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
class NetworkCallbackImpl : NetworkCallback() {
private val TAG = "NetworkCallbackImpl"

View File

@@ -21,12 +21,12 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListe
import com.mogo.eagle.core.function.call.autopilot.CallerFaultManagementStateListenerManager
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhidao.support.adas.high.AdasManager
import com.zhjt.mogo.adas.data.AdasConstants
import com.zhjt.mogo_core_function_devatools.rviz.R
import com.zhjt.mogo_core_function_devatools.rviz.common.config.SSHAccountConfig
import com.zhjt.mogo_core_function_devatools.rviz.common.coroutines.FlowBus
import com.zhjt.mogo_core_function_devatools.rviz.constant.AppConfigInfo
import com.zhjt.mogo_core_function_devatools.rviz.constant.DiagnoseType
import com.zhjt.mogo_core_function_devatools.rviz.constant.EventKey
import com.zhjt.mogo_core_function_devatools.rviz.constant.FaultLevel
import com.zhjt.mogo_core_function_devatools.rviz.constant.FaultModuleId
@@ -68,6 +68,7 @@ import java.util.Locale
import java.util.Timer
import java.util.TimerTask
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicReference
/**
@@ -93,6 +94,7 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
private val dockerInfoMap = mutableMapOf<SSHHostBean, ArrayList<DockerInfo>>()
private var cloudMapVersion = "未知"//云端MAP版本
private var hdMapVersion = HdMapVersion()//高精度版本
private val isReceiveFMData = AtomicBoolean(false)//是否接收到了FM数据
private val queryRosHostArgumentMap =
ConcurrentHashMap<SSHHostBean, Boolean>()//当前参与查询主机参数的主机
@@ -132,9 +134,12 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
override fun onCreate() {
super.onCreate()
initFMData()
CallerAutoPilotStatusListenerManager.addListener(TAG, adasConnectionStatuslistener)
CallerAutoPilotStatusListenerManager.addListener(TAG, adasConnectionStatusListener)
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
CallerFaultManagementStateListenerManager.addListener(TAG, this)
AdasManager.getInstance().carConfig?.let {
onAutopilotCarConfig(it)
}
Log.i(TAG, "故障管理诊断服务已启动")
}
@@ -186,16 +191,8 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
FmEntity("功能状态机&其他(FSM&OTH)")
}
/**
* 启动诊断
*/
fun startDiagnose() {
connectSSH()
}
private val adasConnectionStatuslistener = object : IMoGoAutopilotStatusListener {
@OptIn(DelicateCoroutinesApi::class)
private val adasConnectionStatusListener = object : IMoGoAutopilotStatusListener {
override fun onAutopilotIpcConnectStatusChanged(
status: AdasConstants.IpcConnectionStatus,
@@ -204,28 +201,19 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
super.onAutopilotIpcConnectStatusChanged(status, reason)
val adasConnectStatus = AdasConnectionStatus(status, reason)
when (status) {
AdasConstants.IpcConnectionStatus.DISCONNECTED -> {
}
AdasConstants.IpcConnectionStatus.CONNECTED -> {
if (AdasManager.getInstance().carConfig == null) {
AdasManager.getInstance().sendCarConfigReq()
}
GlobalScope.launch(Dispatchers.IO) {
delay(6000)
updateFaultManagementStop(FMInfoMsg(null, null, null))
}
}
AdasConstants.IpcConnectionStatus.CONNECTING -> {
else -> {
isReceiveFMData.set(false)
}
AdasConstants.IpcConnectionStatus.CONNECT_EXCEPTION -> {
}
AdasConstants.IpcConnectionStatus.SEARCH_ADDRESS -> {}
AdasConstants.IpcConnectionStatus.NOT_FOUND_ADDRESS -> {}
else -> {}
}
FlowBus.with<AdasConnectionStatus>(EventKey.UPDATE_ADAS_CONNECT_STATE)
.post(scopeSubscriber, adasConnectStatus)
@@ -235,7 +223,7 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
//连接SSH
private fun connectSSH() {
fun connectSSH() {
openConnection(
SSH.createHost(
SSHAccountConfig.getUserName(),
@@ -258,35 +246,15 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
private fun updateFaultManagementStop(fmInfo: FMInfoMsg) {
//TODO
// if (isReceiveFMData.get()) {
// return
// }
// isReceiveFMData.set(true)
val msg: String
val type: DiagnoseType
if (fmInfo.fmInfoList != null) {
msg = "FM数据获取成功……"
type = DiagnoseType.SUCCEED
} else {
if (isReceiveFMData.get()) {
return
}
isReceiveFMData.set(true)
if (fmInfo.fmInfoList == null) {
//证明未收到FM数据存在两种情况一个是没有发数据一个是版本不支持
FlowBus.with<Boolean>(EventKey.SEND_IS_SUPPORT_FM)
.post(scopeSubscriber, AppConfigInfo.isSupportFM)
if (AppConfigInfo.isSupportFM) {
msg = "FM数据获取成功……"
type = DiagnoseType.SUCCEED
} else {
msg = "获取FM数据失败此MAP不支持FM相关功能"
type = DiagnoseType.FAILED
}
}
//TODO
// updateDiagnoseUIStateInUIThread(
// DiagnoseSource.ADAS,
// msg,
// type
// )
// executeProcessConnectSSHStart()
}
@@ -491,44 +459,37 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
rosHostArgumentPosition: Int,
isInserted: Boolean
) {
GlobalScope.launch(Dispatchers.Main) {
//TODO
// updateDiagnoseUIState(
// DiagnoseSource.SSH,
// "正在连接${Utils.getIPLastSegment(host.hostname)}……"
// )
synchronized(rosHostArguments) {
val p = getRosHostArgument(host)
val argument = p.second
val isInsert = p.first < 0
if (isInsert) {//不存在
rosHostArguments.add(argument)
//根据IP排序主动连接的主机一般是rosMaster置顶
rosHostArguments.sortWith(Comparator<RosHostArgument> { rosHostArgument1, rosHostArgument2 ->
if (defaultSSH != null) {
if (rosHostArgument1.host == defaultSSH!!.host) {
return@Comparator -1
}
if (rosHostArgument2.host == defaultSSH!!.host) {
return@Comparator 1
}
synchronized(rosHostArguments) {
val p = getRosHostArgument(host)
val argument = p.second
val isInsert = p.first < 0
if (isInsert) {//不存在
rosHostArguments.add(argument)
//根据IP排序主动连接的主机一般是rosMaster置顶
rosHostArguments.sortWith(Comparator<RosHostArgument> { rosHostArgument1, rosHostArgument2 ->
if (defaultSSH != null) {
if (rosHostArgument1.host == defaultSSH!!.host) {
return@Comparator -1
}
rosHostArgument1.host.hostname
.compareTo(rosHostArgument2.host.hostname)
})
} else {
//已存在
argument.resetConnectFailureCode()
}
if (TextUtils.equals(SSHAccountConfig.getRosMasterIp(), argument.host.hostname)) {
argument.isRosMaster = true;
}
val index = rosHostArguments.indexOf(argument)
if (rosHostArgument2.host == defaultSSH!!.host) {
return@Comparator 1
}
}
rosHostArgument1.host.hostname
.compareTo(rosHostArgument2.host.hostname)
})
} else {
//已存在
argument.resetConnectFailureCode()
}
if (TextUtils.equals(SSHAccountConfig.getRosMasterIp(), argument.host.hostname)) {
argument.isRosMaster = true;
}
val index = rosHostArguments.indexOf(argument)
GlobalScope.launch(Dispatchers.Main) {
CallerSshConnectionListenerManager.invokeConnecting(
argument.host, index, isInsert
) //正在连接 在此的 -1和true不使用
)
}
}
Log.i(TAG, "${host.toString()} 连接中")
@@ -540,12 +501,6 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
sshMap.put(ssh.host, ssh)
}
GlobalScope.launch(Dispatchers.Main) {
//TODO
// updateDiagnoseUIState(
// DiagnoseSource.SSH,
// "连接${Utils.getIPLastSegment(ssh.host.hostname)}成功……",
// DiagnoseType.SUCCEED
// )
CallerSshConnectionListenerManager.invokeConnected(ssh)
}
getRosMasterConfig(ssh)
@@ -587,15 +542,8 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
defaultSSH = null
}
GlobalScope.launch(Dispatchers.Main) {
//TODO
// updateDiagnoseUIState(
// DiagnoseSource.SSH,
// "连接${Utils.getIPLastSegment(host.hostname)}失败,原因:$msg……",
// DiagnoseType.FAILED
// )
CallerSshConnectionListenerManager.invokeConnectFailure(host, msg)
}
updateDiagnoseFinish(host)
Log.i(TAG, "${host.toString()} 连接失败=${msg}")
}
@@ -607,11 +555,6 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
) {
if (list.isNotEmpty()) {
dockerInfoMap[host] = list
//TODO
// updateDiagnoseUIStateInUIThread(
// DiagnoseSource.SSH,
// "${Utils.getIPLastSegment(host.hostname)} Docker信息获取成功……"
// )
val mapDocker: DockerInfo? =
list.find { it.names == "autocar_default_1" || it.names == "autocar-default-1" }
if (mapDocker != null) {
@@ -629,7 +572,6 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
}
}
}
updateDiagnoseFinish(host)
} else {
if (dockerInfoMap.containsKey(host))
dockerInfoMap.remove(host)
@@ -765,7 +707,6 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
}
} else if (MogoCommand.QUERY_VEHICLE_CONFIG == cmd) {
vehicleConfig = VehicleConfig(result)
//TODO
// updateDiagnoseUIStateInUIThread(
// DiagnoseSource.SSH,
// "车辆信息,车牌:${vehicleConfig!!.plate} 品牌:${vehicleConfig!!.brand} 类型:${vehicleConfig!!.model}",
@@ -1086,54 +1027,7 @@ class FaultManagementDiagnosisService : Service(), OnSshConnectionListener,
ssh.execCommand(MogoCommand.QUERY_VEHICLE_CONFIG, false) //获取车牌等信息
ssh.execCommand(MogoCommand.QUERY_ROS_SLAVE, false) //获取从ros主机
}
//TODO
// updateDiagnoseUIStateInUIThread(
// DiagnoseSource.SSH,
// "正在获取${Utils.getIPLastSegment(ssh.host.hostname)} Docker信息……"
// )
ssh.execCommand(MogoCommand.QUERY_DOCKER_PS_A, false)
//等待获取Docker信息是否成功
GlobalScope.launch(Dispatchers.IO) {
delay(6000)
if (!dockerInfoMap.containsKey(ssh.host)) {
//TODO
// withContext(Dispatchers.Main) {
// updateDiagnoseUIState(
// DiagnoseSource.SSH,
// "${Utils.getIPLastSegment(ssh.host.hostname)} Docker信息获取失败……",
// DiagnoseType.FAILED
// )
// }
updateDiagnoseFinish(ssh.host)
}
}
}
//检查诊断是否完成,并更新状态
private fun updateDiagnoseFinish(host: SSHHostBean) {
//TODO
// if (!isDiagnoseFinish.get()) {
// synchronized(diagnoseFinishState) {
// if (diagnoseFinishState.containsKey(host)) {
// diagnoseFinishState[host] = true
// }
// }
// val count = diagnoseFinishState.count { it.value }
// if (count == diagnoseFinishState.size) {
// isDiagnoseFinish.set(true)
// val msg =
// if (CallerAutopilotActionsListenerManager.isAutopilotAbility()) "可自动驾驶,请打开「鹰眼」进入运营状态" else "不可自动驾驶,详细信息请关闭《诊断弹窗》查看"
// updateDiagnoseUIStateInUIThread(DiagnoseSource.MC, "诊断完成,当前环境${msg}")
// val vib = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// val vibratorManager =
// getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager
// vibratorManager.defaultVibrator
// } else {
// getSystemService(VIBRATOR_SERVICE) as Vibrator
// }
// vib.vibrate(VibrationEffect.createOneShot(500, 255))
// }
// }
}
private fun queryRosHostArgument(ssh: SSH) {

View File

@@ -49,6 +49,7 @@ class FmdAct : BaseActivity() {
arrayOf("车况概览", "系统资源", "故障码")
private lateinit var overviewFrag: OverviewFrag
private lateinit var systemResourceFrag: SystemResourceFrag
private lateinit var faultCodeFrag: FaultCodeFrag
private val mIconUnselectIds = intArrayOf(
R.drawable.rviz_fmd_tab_car_status_unselect,
@@ -86,9 +87,10 @@ class FmdAct : BaseActivity() {
Utils.getApp().startService(Intent(Utils.getApp(), FmCodeUpdateService::class.java))
registerForContextMenu(clConnectStatusBarView.vehicleNumberView)
overviewFrag = OverviewFrag()
systemResourceFrag = SystemResourceFrag()
faultCodeFrag = FaultCodeFrag()
mFragments.add(overviewFrag)
mFragments.add(SystemResourceFrag())
mFragments.add(systemResourceFrag)
mFragments.add(faultCodeFrag)
for (i in mTitles.indices) {
@@ -201,8 +203,9 @@ class FmdAct : BaseActivity() {
fmdBound =
(service as FaultManagementDiagnosisService.FaultManagementDiagnosisBinder).service
faultCodeFrag.setData(fmdBound!!.fmDataMap)
systemResourceFrag.initData()
overviewFrag.setData(fmdBound!!.fmDataMap)
fmdBound!!.startDiagnose()
fmdBound!!.connectSSH()
}
override fun onServiceDisconnected(className: ComponentName) {

View File

@@ -39,13 +39,17 @@ class SystemResourceFrag : FmdBaseFragment(), OnRosHostClickListener,
override fun onHiddenChanged(hidden: Boolean) {
super.onHiddenChanged(hidden)
if (!hidden) {
if (!isInit) {
isInit = true
rosHostsView.setDatas(
fmdAct.getRosHostArguments(),
fmdAct.getCloudMapVersion()
)
}
initData()
}
}
fun initData() {
if (!isInit) {
isInit = true
rosHostsView.setDatas(
fmdAct.getRosHostArguments(),
fmdAct.getCloudMapVersion()
)
}
}

View File

@@ -27,12 +27,17 @@ import androidx.lifecycle.LifecycleRegistry;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.zhjt.mogo.adas.data.AdasConstants;
import com.zhjt.mogo_core_function_devatools.rviz.R;
import com.zhjt.mogo_core_function_devatools.rviz.common.config.SSHAccountConfig;
import com.zhjt.mogo_core_function_devatools.rviz.common.coroutines.FlowBus;
import com.zhjt.mogo_core_function_devatools.rviz.common.utils.DetectHtml;
import com.zhjt.mogo_core_function_devatools.rviz.common.utils.NetworkUtilsExtend;
import com.zhjt.mogo_core_function_devatools.rviz.constant.AppConfigInfo;
import com.zhjt.mogo_core_function_devatools.rviz.constant.EventKey;
import com.zhjt.mogo_core_function_devatools.rviz.model.entities.AdasConnectionStatus;
import com.zhjt.mogo_core_function_devatools.rviz.ssh.SSH;
import com.zhjt.mogo_core_function_devatools.rviz.ssh.function.call.CallerSshConnectionListenerManager;
import com.zhjt.mogo_core_function_devatools.rviz.ssh.function.listener.OnSshConnectionListener;
import com.zhjt.mogo_core_function_devatools.rviz.ssh.module.SSHHostBean;
import java.net.Inet4Address;
import java.net.InetAddress;
@@ -47,7 +52,7 @@ import mogo.telematics.pad.MessagePad;
/**
* 连接以及状态展示
*/
public class StateBarView extends LinearLayout implements LifecycleOwner, NetworkUtilsExtend.NetworkCallbackListener {
public class StateBarView extends LinearLayout implements LifecycleOwner, NetworkUtilsExtend.NetworkCallbackListener, OnSshConnectionListener {
private static final String TAG = StateBarView.class.getSimpleName();
private final CoroutineScope scopeSubscriber = CoroutineScopeKt.CoroutineScope(MainScope().getCoroutineContext());
private final LifecycleRegistry lifecycle = new LifecycleRegistry(this);
@@ -55,6 +60,7 @@ public class StateBarView extends LinearLayout implements LifecycleOwner, Networ
private TextView ipView;
private TextView vehicleNumberView;
private TextView adasStateView;
private TextView sshStateView;
@NonNull
@Override
@@ -101,7 +107,6 @@ public class StateBarView extends LinearLayout implements LifecycleOwner, Networ
setListener();
initView();
getNetWorkType();
// FlowBus.INSTANCE.<String>with(EventKey.GET_VEHICLE_CONFIG).post(scopeSubscriber, EventKey.GET_VEHICLE_CONFIG);
FlowBus.INSTANCE.<MessagePad.CarConfigResp>with(EventKey.UPDATE_CAR_CONFIG_STATE).register(this, it -> {
setHintTextView(vehicleNumberView, it.getPlateNumber());
});
@@ -109,20 +114,35 @@ public class StateBarView extends LinearLayout implements LifecycleOwner, Networ
String msg = getResources().getString(R.string.rviz_fmd_disconnected);
AdasConstants.IpcConnectionStatus ipcConnectionStatus = it.getIpcConnectionStatus();
String reason = it.getReason();
if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) {
if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.DISCONNECTED) {
msg = getResources().getString(R.string.rviz_fmd_disconnected);
} else if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) {
msg = getResources().getString(R.string.rviz_fmd_connected);
} else if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.DISCONNECTED) {
msg = "连接失败";
} else if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTING) {
msg = "连接中";
if (!TextUtils.isEmpty(reason)) {
if (reason.contains("")) {
String[] str = reason.split("");
msg = str[0];
} else {
msg = reason;
}
}
msg = getResources().getString(R.string.rviz_fmd_connecting);
setHintTextView(netNameView, getNetWorkType());
setHintTextView(ipView, getIpAddressString());
} else if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.RECONNECTING_TIMER ||
ipcConnectionStatus == AdasConstants.IpcConnectionStatus.RECONNECTING_NETWORK) {
msg = getResources().getString(R.string.rviz_fmd_reconnecting);
setHintTextView(netNameView, getNetWorkType());
setHintTextView(ipView, getIpAddressString());
} else if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECT_EXCEPTION) {
msg = getResources().getString(R.string.rviz_fmd_connect_exception);
} else if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.ILLEGAL_ADDRESS) {
msg = getResources().getString(R.string.rviz_fmd_illegal_address);
} else if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.SEARCH_ADDRESS) {
msg = getResources().getString(R.string.rviz_fmd_search_address);
} else if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.NOT_FOUND_ADDRESS) {
msg = getResources().getString(R.string.rviz_fmd_not_found_address);
} else if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CERTIFICATION_FAILED) {
msg = getResources().getString(R.string.rviz_fmd_certification_failed);
} else if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.HEARTBEAT_TIMEOUT) {
msg = getResources().getString(R.string.rviz_fmd_heartbeat_timeout);
} else if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.PROTOCOL_MISMATCH) {
msg = getResources().getString(R.string.rviz_fmd_protocol_mismatch);
} else if (ipcConnectionStatus == AdasConstants.IpcConnectionStatus.SERVER_DISCONNECTED) {
msg = getResources().getString(R.string.rviz_fmd_server_disconnected);
}
setHintTextView(adasStateView, msg);
if (ipcConnectionStatus != AdasConstants.IpcConnectionStatus.CONNECTED) {
@@ -150,10 +170,12 @@ public class StateBarView extends LinearLayout implements LifecycleOwner, Networ
ipView = findViewById(R.id.ip_view);
vehicleNumberView = findViewById(R.id.vehicle_number_view);
adasStateView = findViewById(R.id.adas_state_view);
sshStateView = findViewById(R.id.ssh_state_view);
setHintTextView(netNameView, getNetWorkType());
setHintTextView(ipView, getIpAddressString());
setHintTextView(vehicleNumberView, TextUtils.isEmpty(AppConfigInfo.INSTANCE.getPlateNumber()) ? getResources().getString(R.string.rviz_fmd_disconnected) : AppConfigInfo.INSTANCE.getPlateNumber());
setHintTextView(adasStateView, getResources().getString(R.string.rviz_fmd_disconnected));
setHintTextView(sshStateView, getResources().getString(R.string.rviz_fmd_disconnected));
}
/**
@@ -218,9 +240,20 @@ public class StateBarView extends LinearLayout implements LifecycleOwner, Networ
textView.setText(Html.fromHtml(text));
}
} else {
if (getResources().getString(R.string.rviz_fmd_disconnected).equals(text) || getResources().getString(R.string.rviz_fmd_unknown).equals(text) || "连接失败".equals(text)) {
if (getResources().getString(R.string.rviz_fmd_disconnected).equals(text) ||
getResources().getString(R.string.rviz_fmd_unknown).equals(text) ||
getResources().getString(R.string.rviz_fmd_connect_exception).equals(text) ||
getResources().getString(R.string.rviz_fmd_illegal_address).equals(text) ||
getResources().getString(R.string.rviz_fmd_not_found_address).equals(text) ||
getResources().getString(R.string.rviz_fmd_certification_failed).equals(text) ||
getResources().getString(R.string.rviz_fmd_heartbeat_timeout).equals(text) ||
getResources().getString(R.string.rviz_fmd_protocol_mismatch).equals(text) ||
getResources().getString(R.string.rviz_fmd_server_disconnected).equals(text)) {
textView.setTextColor(getResources().getColor(R.color.rviz_fmd_status_error));
} else if (getResources().getString(R.string.rviz_fmd_gain).equals(text) || "连接中".equals(text) || "重连中".equals(text)) {
} else if (getResources().getString(R.string.rviz_fmd_gain).equals(text) ||
getResources().getString(R.string.rviz_fmd_connecting).equals(text) ||
getResources().getString(R.string.rviz_fmd_reconnecting).equals(text) ||
getResources().getString(R.string.rviz_fmd_search_address).equals(text)) {
textView.setTextColor(Color.YELLOW);
} else {
textView.setTextColor(getResources().getColor(R.color.rviz_fmd_status_normal));
@@ -233,6 +266,8 @@ public class StateBarView extends LinearLayout implements LifecycleOwner, Networ
protected void onAttachedToWindow() {
super.onAttachedToWindow();
lifecycle.setCurrentState(Lifecycle.State.STARTED);
NetworkUtilsExtend.Companion.addNetworkCallback(this);
CallerSshConnectionListenerManager.INSTANCE.addListener(TAG, this);
}
@Override
@@ -240,9 +275,40 @@ public class StateBarView extends LinearLayout implements LifecycleOwner, Networ
super.onDetachedFromWindow();
lifecycle.setCurrentState(Lifecycle.State.DESTROYED);
NetworkUtilsExtend.Companion.removeNetworkCallback(this);
CallerSshConnectionListenerManager.INSTANCE.removeListener(TAG);
}
public View getVehicleNumberView() {
return vehicleNumberView;
}
@Override
public void onSshConnecting(@NonNull SSHHostBean host, int rosHostArgumentPosition, boolean isInserted) {
if (TextUtils.equals(host.getHostname(), SSHAccountConfig.INSTANCE.getRosMasterIp())) {
setHintTextView(sshStateView, "连接中");
}
}
@Override
public void onSshConnected(@NonNull SSH ssh) {
if (TextUtils.equals(ssh.host.getHostname(), SSHAccountConfig.INSTANCE.getRosMasterIp())) {
setHintTextView(sshStateView, getResources().getString(R.string.rviz_fmd_connected));
}
}
@Override
public void onSshDisconnected(@NonNull SSHHostBean host) {
if (TextUtils.equals(host.getHostname(), SSHAccountConfig.INSTANCE.getRosMasterIp())) {
setHintTextView(sshStateView, "已断开");
}
}
@Override
public void onSshConnectFailure(@NonNull SSHHostBean host, @NonNull String msg) {
if (TextUtils.equals(host.getHostname(), SSHAccountConfig.INSTANCE.getRosMasterIp())) {
setHintTextView(sshStateView, "连接失败");
setHintTextView(netNameView, getNetWorkType());
setHintTextView(ipView, getIpAddressString());
}
}
}

View File

@@ -2,9 +2,7 @@ package com.zhjt.mogo_core_function_devatools.rviz.widgets.ros.host;
import android.content.Context;
import android.graphics.Rect;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;

View File

@@ -11,7 +11,7 @@
<LinearLayout
style="@style/RvizFmdStateBarLayoutStyle"
android:layout_weight="1.1">
android:layout_weight="1">
<TextView
style="@style/RvizFmdStateBarHintStyle"
@@ -38,7 +38,7 @@
<LinearLayout
style="@style/RvizFmdStateBarLayoutStyle"
android:layout_weight=".8">
android:layout_weight=".7">
<TextView
style="@style/RvizFmdStateBarHintStyle"
@@ -51,20 +51,7 @@
<LinearLayout
style="@style/RvizFmdStateBarLayoutStyle"
android:layout_weight="1.2">
<TextView
style="@style/RvizFmdStateBarHintStyle"
android:text="ROS Master SSH状态" />
<TextView
android:id="@+id/ssh_state_view"
style="@style/RvizFmdStateBarValueStyle" />
</LinearLayout>
<LinearLayout
style="@style/RvizFmdStateBarLayoutStyle"
android:layout_weight="0.8">
android:layout_weight="0.9">
<TextView
style="@style/RvizFmdStateBarHintStyle"
@@ -75,5 +62,18 @@
style="@style/RvizFmdStateBarValueStyle" />
</LinearLayout>
<LinearLayout
style="@style/RvizFmdStateBarLayoutStyle"
android:layout_weight="1.3">
<TextView
style="@style/RvizFmdStateBarHintStyle"
android:text="ROS Master SSH状态" />
<TextView
android:id="@+id/ssh_state_view"
style="@style/RvizFmdStateBarValueStyle" />
</LinearLayout>
</LinearLayout>

View File

@@ -1,8 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rviz_fmd_unknown">未知</string>
<string name="rviz_fmd_connected">已连接</string>
<string name="rviz_fmd_disconnected">未连接</string>
<string name="rviz_fmd_connected">已连接</string>
<string name="rviz_fmd_connecting">连接中</string>
<string name="rviz_fmd_reconnecting">重连中</string>
<string name="rviz_fmd_connect_exception">连接失败</string>
<string name="rviz_fmd_illegal_address">地址非法</string>
<string name="rviz_fmd_search_address">搜索域控</string>
<string name="rviz_fmd_not_found_address">找不到域控</string>
<string name="rviz_fmd_certification_failed">认证异常</string>
<string name="rviz_fmd_heartbeat_timeout">心跳超时</string>
<string name="rviz_fmd_protocol_mismatch">协议不匹配</string>
<string name="rviz_fmd_server_disconnected">域控断开</string>
<string name="rviz_fmd_gain">获取中</string>
<string name="rviz_fmd_wifi">(WiFi)</string>
<string name="rviz_fmd_mobile_network">移动网络</string>

View File

@@ -1567,7 +1567,9 @@ internal class DebugSettingView @JvmOverloads constructor(
*/
@SuppressLint("SetTextI18n")
private fun setDomainControllerCheckedChangeListener() {
etAutopilotIP.setText("192.168.1.")
val string = SharedPrefsMgr.getInstance()
.getString(SharedPrefsConstants.inputIpDomainController, "192.168.1.")
etAutopilotIP.setText(string)
etAutopilotIP.text?.let { etAutopilotIP.setSelection(it.length) }
//设置工控机IP
btnSetAutopilotIP.setOnClickListener {
@@ -1575,6 +1577,7 @@ internal class DebugSettingView @JvmOverloads constructor(
if (autoPilotIp.isNotEmpty()) {
SSHAccountConfig.setRosMasterIp(autoPilotIp.split(":", "").first())
CallerAutoPilotControlManager.resetIpAddress(autoPilotIp)
SharedPrefsMgr.getInstance().putString(SharedPrefsConstants.inputIpDomainController,autoPilotIp)
} else {
ToastUtils.showShort("请输入正确的IP地址")
}

View File

@@ -75,8 +75,8 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
}
private val isB2 by lazy {
AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)
private val isB1 by lazy {
AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)
}
private var currentEventUUID: String = ""
@@ -93,7 +93,7 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
private fun initView() {
if (isPassengerScreen) {
if (isB2) {
if (isB1) {
setB2PassengerScreenView()
} else {
setTaxiPassengerScreenView()

View File

@@ -18,4 +18,6 @@ public class SharedPrefsConstants {
public static final String APP_UPGRADE_CONTENT = "app_upgrade_content";
public static final String APP_MAC = "app_mac";
public static final String inputIpDomainController = "InputIpDomainController";
}