diff --git a/OCH/mogo-och-noop/src/main/res/layout/och_noop_fragment_hmi.xml b/OCH/mogo-och-noop/src/main/res/layout/och_noop_fragment_hmi.xml index 618bcdaad4..41e0f55c3c 100644 --- a/OCH/mogo-och-noop/src/main/res/layout/och_noop_fragment_hmi.xml +++ b/OCH/mogo-och-noop/src/main/res/layout/och_noop_fragment_hmi.xml @@ -13,14 +13,6 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> - - - ? { + fun getCurrentOrderTrajectoryList(): MutableList { return mTaskTrajectoryList } @@ -250,18 +230,26 @@ object TaxiTaskModel { * false: 暂停启动自驾 */ fun handleBrakeStatusChange(brakeStatus: Boolean) { - if (brakeStatus){ - mControllerStatusCallback?.resumeOpenAutopilotNonManual() - }else{ - mControllerStatusCallback?.pauseOpenAutopilotNonManual() - } + if (brakeStatus) { + mControllerStatusCallback?.resumeOpenAutopilotNonManual() + } else { + mControllerStatusCallback?.pauseOpenAutopilotNonManual() + } } private val mMogoAutopilotStatusListener: IMoGoAutopilotStatusListener = object : IMoGoAutopilotStatusListener { override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) { - DebugView.printInfoMsg("[域控连接状态变化] status=$status, reason=${if (TextUtils.isEmpty(reason)) "" else reason}") + DebugView.printInfoMsg( + "[域控连接状态变化] status=$status, reason=${ + if (TextUtils.isEmpty( + reason + ) + ) "" else reason + }" + ) } + override fun onAutopilotGuardian(guardianInfo: MogoReportMessage?) { TaxiTrajectoryManager.getInstance().onAutopilotGuardian(guardianInfo) } @@ -295,7 +283,8 @@ object TaxiTaskModel { if ((FunctionBuildConfig.isDemoMode && checkCurrentTaskCondition() && QueryCurrentTaskRespBean.isStartTaskType(mCurrentTaskWithOrder) - )){ + ) + ) { // 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态 return } @@ -305,20 +294,20 @@ object TaxiTaskModel { if ((FunctionBuildConfig.isDemoMode && checkCurrentTaskCondition() && QueryCurrentTaskRespBean.isStartTaskType(mCurrentTaskWithOrder) - ) + ) ) { // 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态 return } - if (mADASStatusCallback != null) { - mADASStatusCallback!!.onAutopilotDisable() - } + mADASStatusCallback?.onAutopilotDisable() } else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) { DebugView.printInfoMsg("[自驾状态变化] afterValue=STATUS_PARALLEL_DRIVING,meaning=平行驾驶中") if (FunctionBuildConfig.isDemoMode) { if ((checkCurrentTaskCondition() - && QueryCurrentTaskRespBean.isStartTaskType(mCurrentTaskWithOrder) - ) + && QueryCurrentTaskRespBean.isStartTaskType( + mCurrentTaskWithOrder + ) + ) ) { //订单中 // 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态 } else { //美化模式下没订单,显示人工驾驶 @@ -330,7 +319,6 @@ object TaxiTaskModel { } } - override fun onAutopilotSNRequest() {} override fun onAutopilotArriveAtStation(arrivalNotification: ArrivalNotification?) { i(TAG, "onAutopilotArriveAtStation = ${arrivalNotification.toString()}") DebugView.printInfoMsg("[MAP到站通知] 上报到站,location=${arrivalNotification?.endLocation}") @@ -354,9 +342,6 @@ object TaxiTaskModel { } } - override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {} - - override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {} } private val mMogoStatusChangedListener: IMogoStatusChangedListener = @@ -402,7 +387,7 @@ object TaxiTaskModel { if (checkCurrentTaskCondition()) { d(TAG, "--------本地开始计算全路径数据---------- ") //转换成高德坐标系 - if (mCurrentTaskRoutePointsGcj!!.size > 0) { + if (mCurrentTaskRoutePointsGcj.size > 0) { mCurrentTaskRoutePointsGcj.clear() } mCurrentTaskRoutePointsGcj.addAll( @@ -450,7 +435,7 @@ object TaxiTaskModel { return OCHOperationalMessage::class.java } - override fun onMsgReceived(obj: OCHOperationalMessage) { + override fun onMsgReceived(obj: OCHOperationalMessage?) { if (obj == null) { d(TAG, "onMsgReceived = null") return @@ -478,17 +463,18 @@ object TaxiTaskModel { } private val localCalculateDistanceListener: IDistanceListener = object : IDistanceListener { - override fun distanceCallback(lastSumLength: Float) { - val lastTime = lastSumLength / TaxiUnmannedConst.TAXI_AVERAGE_SPEED * 3.6 //秒 + override fun distanceCallback(distance: Float) { + val lastTime = distance / TaxiUnmannedConst.TAXI_AVERAGE_SPEED * 3.6 //秒 d( TAG, - "dynamicCalculateRouteInfo: lastSumLength=$lastSumLength, lastTime=$lastTime, threadName=Thread.currentThread().name" + "dynamicCalculateRouteInfo: lastSumLength=$distance, lastTime=$lastTime, threadName=Thread.currentThread().name" ) mTaxiTaskWithOrderCallbackMap.forEach { val listener = it.value listener.onTaskTripInfoLocalCalculateChanged( - lastSumLength.toLong(), - lastTime.toLong()) + distance.toLong(), + lastTime.toLong() + ) } } } @@ -520,7 +506,7 @@ object TaxiTaskModel { ) routeArrivingTemp.add(temp) } - mAutopilotPlanningCallback!!.routeResult( + mAutopilotPlanningCallback?.routeResult( routeArriviedTemp, routeArrivingTemp, location @@ -569,7 +555,7 @@ object TaxiTaskModel { siteId: Long, isArriveAtEndSite: Boolean, isArrivedNearestStation: Boolean = false ) { - if (mIsArrivedSiteTag){ + if (mIsArrivedSiteTag) { DebugView.printInfoMsg("arriveSite接口正在调用中") i(TAG, message = "arriveSite接口正在调用中 mIsArrivedSite = $mIsArrivedSiteTag") return @@ -678,7 +664,7 @@ object TaxiTaskModel { ) return } - val result: QueryCurrentTaskRespBean.Result = data.data!! + val result: QueryCurrentTaskRespBean.Result? = data.data d( TAG, "queryCurrentTaskOnce onSuccess:result=${GsonUtil.jsonFromObject(result)}" @@ -705,15 +691,13 @@ object TaxiTaskModel { } //订单或者伪任务更新, 都去刷新下界面 - if (mCurrentTaskWithOrder == null - || !mCurrentTaskWithOrder!!.equals(result) - ) { + if (mCurrentTaskWithOrder == null || mCurrentTaskWithOrder!! != result) { d(TAG, "queryCurrentTaskOnce: 更新本地数据") mCurrentTaskWithOrder = result // 任务为空 - if (result.endSite == null && result.order == null) { + if (result?.endSite == null && result?.order == null) { d(TAG, "queryCurrentTaskOnce: 任务为空") if (mDriveToNearestStationTask == null) { mTaxiTaskWithOrderCallbackMap.forEach { @@ -728,7 +712,7 @@ object TaxiTaskModel { //8.29更新: 当前任务完成且订单状态为乘客已上车, 则立马去拉取任务 不再等120s,否则送驾任务要等120s后才能去执行 // 主要是解决A-B演练任务同时接到A-B订单状态流转的问题 //注意: 需要去除到达乘客上车点的节点, 这个节点不拉取任务 - if (result?.currentStatus == TaskStatusEnum.CompleteTask.code + if (result.currentStatus == TaskStatusEnum.CompleteTask.code ) { mADASStatusCallback?.updateAutopilotStatus() mTaxiTaskWithOrderCallbackMap.forEach { @@ -749,7 +733,7 @@ object TaxiTaskModel { } //根据lineId集合去查轨迹集合, 返回的只是接驾任务的line集合, 没有送驾任务 - var linesIds = arrayListOf() + val linesIds = arrayListOf() linesIds.add(result.lineId) // 当前任务的 result.order?.also { linesIds.addAll(it.planningLines) // 接驾 @@ -886,7 +870,7 @@ object TaxiTaskModel { object : OchCommonServiceCallback { override fun onSuccess(data: BaseData?) { DebugView.printInfoMsg("[开始任务] 请求success,lindId=$lineId") - if (isStartAutopilot){ + if (isStartAutopilot) { startAutoPilot() //自驾开启 } d(TAG, "startTask onSuccess: data=${GsonUtil.jsonFromObject(data)}") @@ -911,7 +895,7 @@ object TaxiTaskModel { }) } - fun prepareNextTask(delayTime: Long,siteId: Long) { + fun prepareNextTask(delayTime: Long, siteId: Long) { DebugView.printInfoMsg("[PrepareNextTask] 准备发送请求, siteId=$siteId") TaxiTaskWithOrderServiceManager.prepareTask( mContext, @@ -930,7 +914,7 @@ object TaxiTaskModel { DebugView.printErrorMsg("[PrepareNextTask] 请求fail, code=$code ,msg=$msg") d(TAG, "prepareNextTask onFail: code=$code ,msg=$msg") if (LoginStatusManager.isLogin() && TaxiCarServingStatusManager.isCarServingStatus()) { - startPrepareTaskDelay(delayTime,siteId) + startPrepareTaskDelay(delayTime, siteId) } } }) @@ -940,12 +924,12 @@ object TaxiTaskModel { removePrepareTaskDelay() mPrepareTaskDelayRunnable = Runnable { - prepareNextTask(delayTime,siteId) + prepareNextTask(delayTime, siteId) } mTaxiTaskWithOrderCallbackMap.forEach { val listener = it.value - listener.onStartPrepareTaskUI(delayTime,true) + listener.onStartPrepareTaskUI(delayTime, true) } DebugView.printInfoMsg("[PrepareNextTask] 倒计时${delayTime / 1000}秒后prepareNextTask, siteId=$siteId") UiThreadHandler.postDelayed( @@ -960,7 +944,7 @@ object TaxiTaskModel { UiThreadHandler.removeCallbacks(mPrepareTaskDelayRunnable) mTaxiTaskWithOrderCallbackMap.forEach { val listener = it.value - listener.onStartPrepareTaskUI(0,false) + listener.onStartPrepareTaskUI(0, false) } mPrepareTaskDelayRunnable = null } @@ -970,7 +954,13 @@ object TaxiTaskModel { * 查询当前任务的轨迹 */ fun queryTaskTrajectoryByLineIds(planningLineIds: Array, currentTaskLineId: Long) { - DebugView.printInfoMsg("[查询轨迹信息] 准备发送请求,currentTaskLineId=$currentTaskLineId, planningLineIds=${GsonUtil.jsonFromObject(planningLineIds)}") + DebugView.printInfoMsg( + "[查询轨迹信息] 准备发送请求,currentTaskLineId=$currentTaskLineId, planningLineIds=${ + GsonUtil.jsonFromObject( + planningLineIds + ) + }" + ) TaxiTaskWithOrderServiceManager.queryTrajectoryByLindIds( mContext, planningLineIds, @@ -980,7 +970,13 @@ object TaxiTaskModel { TAG, "queryTaskTrajectoryByLineIds onSuccess: ${GsonUtil.jsonFromObject(data?.data)}" ) - DebugView.printInfoMsg("[查询轨迹信息] 请求success, currentTaskLineId=$currentTaskLineId, planningLineIds=${GsonUtil.jsonFromObject(planningLineIds)}") + DebugView.printInfoMsg( + "[查询轨迹信息] 请求success, currentTaskLineId=$currentTaskLineId, planningLineIds=${ + GsonUtil.jsonFromObject( + planningLineIds + ) + }" + ) data?.data?.also { mTaskTrajectoryList.addAll(it) mCurrentTaskTrajectory = it.first { currentTaskLineId == it.lineId } @@ -1033,8 +1029,8 @@ object TaxiTaskModel { //暂停接单状态下,去接单 DebugView.printInfoMsg("[开始接单] 准备发送请求") TaxiTaskWithOrderServiceManager.startService(mContext, - CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().latitude, - CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().longitude, + getChassisLocationGCJ02().latitude, + getChassisLocationGCJ02().longitude, object : OchCommonServiceCallback { override fun onSuccess(data: StartServiceRespBean?) { if (data == null) return @@ -1079,13 +1075,13 @@ object TaxiTaskModel { paramIndexes = [-1] ) - fun startAutopilotByClick(){ + fun startAutopilotByClick() { //订单状态流转成功, 点击了开启自驾按钮, 启动自驾 if (QueryCurrentTaskRespBean.isStartTaskType(mCurrentTaskWithOrder)) { startAutoPilot() - }else if (QueryCurrentTaskRespBean.isGetTaskType(mCurrentTaskWithOrder)){ + } else if (QueryCurrentTaskRespBean.isGetTaskType(mCurrentTaskWithOrder)) { startTask(mCurrentTaskWithOrder!!.lineId, true) - }else{ + } else { e(TAG, "task currentStatus is not StartTask.") DebugView.printInfoMsg("[启自驾] task currentStatus is not StartTask") } @@ -1168,9 +1164,7 @@ object TaxiTaskModel { mCurrentTaskWithOrder!!.lineId, if (mCurrentTaskWithOrder!!.order != null) mCurrentTaskWithOrder!!.order!!.orderNo else "" ) - if (mControllerStatusCallback != null) { - mControllerStatusCallback!!.startOpenAutopilot() - } + mControllerStatusCallback?.startOpenAutopilot() } private fun initAutopilotControlParameters(): AutopilotControlParameters? { @@ -1306,16 +1300,12 @@ object TaxiTaskModel { curTaskAndOrder.endSite!!.gcjLat, curTaskAndOrder.endSite!!.gcjLon ) - if (mAutopilotPlanningCallback != null) { - mAutopilotPlanningCallback!!.setLineMarker(startStation, endStation) - } + mAutopilotPlanningCallback?.setLineMarker(startStation, endStation) } } private fun cleanLineMarker() { - if (mAutopilotPlanningCallback != null) { - mAutopilotPlanningCallback!!.setLineMarker(null, null) - } + mAutopilotPlanningCallback?.setLineMarker(null, null) } /** @@ -1339,7 +1329,7 @@ object TaxiTaskModel { // 登出 fun logout() { - loginService!!.loginOut( + loginService?.loginOut( getChassisLocationGCJ02().latitude, getChassisLocationGCJ02().longitude ) @@ -1350,18 +1340,15 @@ object TaxiTaskModel { //导航去订单终点目的地 fun startNaviToEndStation(isShow: Boolean) { - if (mCurrentTaskRoutePointsGcj == null) return if (mCurrentTaskRoutePointsGcj.size > 0) { //使用自驾轨迹 - if (mOrderStatusCallback != null) { - mOrderStatusCallback!!.onNaviToEnd(false, isShow) - } + mOrderStatusCallback?.onNaviToEnd(false, isShow) } else { //若直接要显示导航地图则直接导航, 若不是则2s后若无轨迹数据使用高德导航 - if (isShow && mOrderStatusCallback != null) { - mOrderStatusCallback!!.onNaviToEnd(true, true) + if (isShow) { + mOrderStatusCallback?.onNaviToEnd(true, true) } else { UiThreadHandler.postDelayed({ - if (mCurrentTaskRoutePointsGcj.size == 0 && mOrderStatusCallback != null) { - mOrderStatusCallback!!.onNaviToEnd(true, false) + if (mCurrentTaskRoutePointsGcj.size == 0) { + mOrderStatusCallback?.onNaviToEnd(true, false) } }, 2000L) } @@ -1453,7 +1440,7 @@ object TaxiTaskModel { d( TAG, "stopAutoStartAutopilot = ${mCurrentTaskWithOrder?.currentStatus}" ) - if (QueryCurrentTaskRespBean.isGetTaskType(mCurrentTaskWithOrder)){ + if (QueryCurrentTaskRespBean.isGetTaskType(mCurrentTaskWithOrder)) { mControllerStatusCallback?.stopOpenAutopilotNonManual() mTaxiTaskWithOrderCallbackMap.forEach { val listener = it.value @@ -1462,14 +1449,14 @@ object TaxiTaskModel { } } - fun pauseStartAutopilot(){ + fun pauseStartAutopilot() { mTaxiTaskWithOrderCallbackMap.forEach { val listener = it.value listener.onPauseStartAutopilot() } } - fun resumeStartAutopilot(remainingTime: Long){ + fun resumeStartAutopilot(remainingTime: Long) { mTaxiTaskWithOrderCallbackMap.forEach { val listener = it.value listener.onStartAutopilot(remainingTime) diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt index e8e0bd593c..a4cbfcd60d 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt @@ -11,6 +11,7 @@ import com.mogo.eagle.core.data.biz.trafficlight.isInRange import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager +import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X @@ -20,7 +21,8 @@ import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandl import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT import com.mogo.eagle.function.biz.v2x.trafficlight.network.TrafficLightNetWorkModel -class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener { +class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener, + CallerMapRoadListenerManager.OnRoadListener { companion object { @@ -40,6 +42,8 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener { @Volatile private var trafficLightResult: TrafficLightResult? = null + @Volatile + private var mCross: Boolean = false private var inRange: Boolean = false @Volatile private var firstLoopCrossRoad: Boolean = true //开启循环请求路口 @@ -49,6 +53,7 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener { fun initServer(context: Context) { mContext = context CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this) + CallerMapRoadListenerManager.registerRoadListener(TAG, this) mThreadHandler = TrafficLightThreadHandler(Looper.getMainLooper(), { //第一次查询路口时,如果红绿灯显示,则隐藏掉 @@ -118,6 +123,11 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener { mThreadHandler?.sendEmptyMessageDelayed(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD, 5_000L) } + override fun onRoadChange(cross: Boolean) { + super.onRoadChange(cross) + mCross = cross + } + private fun checkOutOfRange() { mLocation?.let { loc -> roadIDResult?.let { @@ -128,7 +138,7 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener { CallerTrafficLightListenerManager.invokeEnterCrossRoad(true) return } - if (inRange) { + if (inRange || !mCross) { // CallerLogger.d(M_V2X + TAG, "离开路口") CallerTrafficLightListenerManager.invokeEnterCrossRoad(false) inRange = false diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/utils/V2XEventAnalyticsManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/utils/V2XEventAnalyticsManager.kt index 419280320a..034aa542f8 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/utils/V2XEventAnalyticsManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/utils/V2XEventAnalyticsManager.kt @@ -5,8 +5,6 @@ import com.mogo.commons.utils.MogoAnalyticUtils import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.enums.CommunicationType import com.mogo.eagle.core.data.enums.DataSourceType -import com.mogo.eagle.core.data.map.MogoLocation -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener import com.mogo.eagle.core.function.api.biz.IFuncBizProvider import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager import com.mogo.eagle.core.function.call.biz.CallerFuncBizListenerManager @@ -17,7 +15,7 @@ import java.util.concurrent.atomic.AtomicBoolean /** * V2X消息播报埋点统计 */ -object V2XEventAnalyticsManager: IMoGoChassisLocationWGS84Listener,IFuncBizProvider{ +object V2XEventAnalyticsManager: IFuncBizProvider{ private const val TAG = "V2XEventAnalyticsManager" private val hasInit by lazy { AtomicBoolean(false) } @@ -38,10 +36,6 @@ object V2XEventAnalyticsManager: IMoGoChassisLocationWGS84Listener,IFuncBizProvi private const val EVENT_PARAMS_LATITUDE ="latitude" // 纬度 private const val EVENT_PARAMS_HEADING ="heading" // 航向角 - private var longitude: Double?=null //经度 - private var latitude: Double?=null //纬度 - private var heading: Double?=null //航向角 - private var oldTime = System.currentTimeMillis() fun init(){ @@ -52,13 +46,11 @@ object V2XEventAnalyticsManager: IMoGoChassisLocationWGS84Listener,IFuncBizProvi private fun registerListener(){ // 添加 ADAS车辆状态&定位 监听 - CallerChassisLocationWGS84ListenerManager.addListener(TAG, this) CallerFuncBizListenerManager.addListener(TAG,this) } private fun unRegisterListener(){ // 移除 ADAS车辆状态&定位 监听 - CallerChassisLocationWGS84ListenerManager.removeListener(TAG) CallerFuncBizListenerManager.removeListener(TAG) } @@ -87,9 +79,9 @@ object V2XEventAnalyticsManager: IMoGoChassisLocationWGS84Listener,IFuncBizProvi msgEventParams[EVENT_PARAMS_PLATE_NUMBER] = AppConfigInfo.plateNumber //车牌号 msgEventParams[EVENT_PARAMS_CAR_SN] = MoGoAiCloudClientConfig.getInstance().sn //鹰眼SN msgEventParams[EVENT_PARAMS_EYE_VERSION] = AppUtils.getAppVersionName() //鹰眼版本 - msgEventParams[EVENT_PARAMS_LONGITUDE] = "$longitude" //经度 - msgEventParams[EVENT_PARAMS_LATITUDE] = "$latitude" //纬度 - msgEventParams[EVENT_PARAMS_HEADING] = "$heading" //航向角 + msgEventParams[EVENT_PARAMS_LONGITUDE] = "${CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude}" //经度 + msgEventParams[EVENT_PARAMS_LATITUDE] = "${CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude}" //纬度 + msgEventParams[EVENT_PARAMS_HEADING] = "${CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().heading}" //航向角 MogoAnalyticUtils.track(EVENT_KEY_RECEIVE_V2X_MSG,msgEventParams) } @@ -109,20 +101,12 @@ object V2XEventAnalyticsManager: IMoGoChassisLocationWGS84Listener,IFuncBizProvi msgEventParams[EVENT_PARAMS_PLATE_NUMBER] = AppConfigInfo.plateNumber //车牌号 msgEventParams[EVENT_PARAMS_CAR_SN] = MoGoAiCloudClientConfig.getInstance().sn //鹰眼SN msgEventParams[EVENT_PARAMS_EYE_VERSION] = AppUtils.getAppVersionName() //鹰眼版本 - msgEventParams[EVENT_PARAMS_LONGITUDE] = "$longitude" //经度 - msgEventParams[EVENT_PARAMS_LATITUDE] = "$latitude" //纬度 - msgEventParams[EVENT_PARAMS_HEADING] = "$heading" //航向角 + msgEventParams[EVENT_PARAMS_LONGITUDE] = "${CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude}" //经度 + msgEventParams[EVENT_PARAMS_LATITUDE] = "${CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude}" //纬度 + msgEventParams[EVENT_PARAMS_HEADING] = "${CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().heading}" //航向角 MogoAnalyticUtils.track(EVENT_KEY_V2X_MSG_EVENT,msgEventParams) } - override fun onChassisLocationWGS84(gnssInfo: MogoLocation) { - gnssInfo.let { - longitude = it.longitude - latitude = it.latitude - heading = it.heading - } - } - fun onDestroy(){ if (hasInit.compareAndSet(true, false)){ unRegisterListener() diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt index 865d1ab0c5..7707869bda 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt @@ -17,12 +17,10 @@ import com.mogo.eagle.core.data.deva.badcase.BagDescriptionEntity import com.mogo.eagle.core.data.deva.badcase.BagInfoEntity import com.mogo.eagle.core.data.deva.badcase.BagManagerEntity import com.mogo.eagle.core.data.deva.badcase.RecordCaseEntity -import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84 import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA import com.mogo.eagle.core.utilcode.mogo.toast.TipToast @@ -37,12 +35,10 @@ import com.zhidao.loglib.upload.UploadManager import com.zhidao.loglib.util.FileUtil import com.zhjt.mogo_core_function_devatools.R import com.zhjt.mogo_core_function_devatools.badcase.BadCaseAnalyticsManager -import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig import com.zhjt.mogo_core_function_devatools.badcase.record.RecordManager import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch -import mogo.telematics.pad.MessagePad import record_cache.RecordPanelOuterClass import java.io.File import java.lang.StringBuilder @@ -55,7 +51,7 @@ import java.util.* * @since: 2022/7/13 */ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchListener, - IMoGoAutopilotRecordListener, IMoGoChassisLocationWGS84Listener { + IMoGoAutopilotRecordListener { companion object { const val TAG = "InitiativeBadCaseWindow" @@ -94,8 +90,6 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList private var recordFileName: String?=null //录制文件包名 private var receiveTime: String?= null private var uploadStamp: String = System.currentTimeMillis().toString() - private var longitude: Double?=null - private var latitude: Double?=null private var bagManagerEntity: BagManagerEntity = BagManagerEntity() @@ -109,7 +103,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList private var clickListener: ClickListener? = null init { - initFloatWindow(); + initFloatWindow() } private val presenter by lazy { @@ -147,8 +141,6 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList //采集结果回调监听 CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(),this) - // 添加 ADAS车辆状态&定位 监听 - CallerChassisLocationWGS84ListenerManager.addListener(this.hashCode().toString(), this) viewAudioButton.setOnClickListener { audioStatus = !audioStatus setAudio(audioStatus) @@ -309,14 +301,14 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList itx["audioUrl"] = downloadUrl?:"" //音频COS地址 itx["mapVersion"] = BadCaseConfig.dockerVersion ?:"" //工控机版本 itx["eyeVersion"] = AppUtils.getAppVersionName() //鹰眼版本 - itx["coordinate"] = "latitude:${latitude};longitude:${longitude}" //坐标 + itx["coordinate"] = "latitude:${getChassisLocationWGS84().latitude};longitude:${getChassisLocationWGS84().longitude}" //坐标 }) if (uploadResult == null || uploadResult.code != 200) { TipToast.shortTip("上报失败") } else { TipToast.shortTip("上报成功") //将上报BI的结果同步给工控机记录保存 - recordKey?.let { + recordKey.let { val hasAudio = downloadUrl != null val descReqEntity = BagDescriptionEntity(uploadReason.toString(),hasAudio,downloadUrl.toString(),true) bagManagerEntity.reqType = 5 @@ -324,15 +316,16 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList bagManagerEntity.descReq = descReqEntity CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity) } + val loc = getChassisLocationWGS84() BadCaseAnalyticsManager.bagRecordUpload(recordKey.toString(),recordFileName?:"",uploadStamp, "100",AppConfigInfo.plateNumber,BadCaseConfig.totalDuration.toString(),MoGoAiCloudClientConfig.getInstance().sn, - BadCaseConfig.dockerVersion ?:"",AppUtils.getAppVersionName(),latitude.toString(),longitude.toString(), + BadCaseConfig.dockerVersion ?:"",AppUtils.getAppVersionName(),loc.latitude.toString(),loc.longitude.toString(), BadCaseConfig.identity,downloadUrl?:"",uploadReason.toString(),System.currentTimeMillis().toString(),"1") //日志 CallerLogger.i("$M_DEVA$TAG", "BadCase Initiative Analytics="+"key="+recordKey+" filename="+recordFileName+ " receiveTime="+uploadStamp+" stat="+"100"+" plateNumber="+AppConfigInfo.plateNumber+ " totalDuration="+ BadCaseConfig.totalDuration +" carSn="+MoGoAiCloudClientConfig.getInstance().sn+" mapVersion="+BadCaseConfig.dockerVersion+ - " eyeVersion="+AppUtils.getAppVersionName()+" latitude="+ latitude +" longitude="+ longitude+ + " eyeVersion="+AppUtils.getAppVersionName()+" latitude="+ loc.latitude +" longitude="+ loc.longitude+ " identity="+BadCaseConfig.identity + " downloadUrl="+downloadUrl +" uploadReason="+uploadReason+ " uploadTime="+System.currentTimeMillis()+" channel="+"1") BadCaseConfig.windowNum-- @@ -413,8 +406,6 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList fun hideFloatWindow() { //注销采集结果回调监听 CallerAutopilotRecordListenerManager.removeListener(this.hashCode().toString()) - // 移除 ADAS车辆状态&定位 监听 - CallerChassisLocationWGS84ListenerManager.removeListener(this.hashCode().toString()) if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout) } @@ -440,9 +431,4 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList fun closeWindow() } - override fun onChassisLocationWGS84(gnssInfo: MogoLocation) { - latitude = gnssInfo.latitude - longitude = gnssInfo.longitude - } - } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/PassiveBadCaseWindow.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/PassiveBadCaseWindow.kt index 3417082456..352f678b83 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/PassiveBadCaseWindow.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/PassiveBadCaseWindow.kt @@ -6,8 +6,6 @@ import android.graphics.Color import android.graphics.PixelFormat import android.os.CountDownTimer import android.os.Handler -import android.os.Parcel -import android.os.Parcelable import android.util.DisplayMetrics import android.view.* import android.widget.CheckBox @@ -19,10 +17,8 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.deva.badcase.BagDescriptionEntity import com.mogo.eagle.core.data.deva.badcase.BagManagerEntity -import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.RecordBagMsg -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager @@ -38,7 +34,6 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig import com.zhjt.mogo_core_function_devatools.badcase.record.RecordManager import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch -import mogo.telematics.pad.MessagePad import com.zhidao.loglib.upload.UploadManager import com.zhidao.loglib.util.FileUtil import com.zhjt.mogo_core_function_devatools.badcase.BadCaseAnalyticsManager @@ -52,7 +47,7 @@ import java.io.File * @since: 2022/7/17 */ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListener, - IMoGoChassisLocationWGS84Listener, CompoundButton.OnCheckedChangeListener { + CompoundButton.OnCheckedChangeListener { companion object { const val TAG = "PassiveBadCaseWindow" @@ -74,8 +69,6 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene private var receiveTime: String ?= null //接收时间 private var stat: String = "" private var boxBean: MsgBoxBean ?= null - private var longitude: Double = 0.0 - private var latitude: Double = 0.0 private var mInViewX = 0f private var mInViewY = 0f @@ -100,7 +93,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene private lateinit var flReasonLayout: FlexboxLayout init { - initFloatWindow(); + initFloatWindow() } private val presenter by lazy { @@ -126,8 +119,6 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene BadCaseConfig.windowNum++ tvPassiveTime.text = "时间:${millis2String(System.currentTimeMillis(),TimeUtils.getHourMinSecondFormat())}" tvPassiveIdentity.text = "身份:${BadCaseConfig.identity}" - // 添加 ADAS车辆状态&定位 监听 - CallerChassisLocationWGS84ListenerManager.addListener(TAG, this) viewAudioButton.setOnClickListener { audioStatus = !audioStatus setAudio(audioStatus) @@ -271,7 +262,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene itx["audioUrl"] = downloadUrl?:"" //音频COS地址 itx["mapVersion"] = BadCaseConfig.dockerVersion ?:"" //工控机版本 itx["eyeVersion"] = AppUtils.getAppVersionName() //鹰眼版本 - itx["coordinate"] = "latitude:${latitude};longitude:${longitude}" //坐标 + itx["coordinate"] = "latitude:${CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude};longitude:${CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude}" //坐标 }) if (uploadResult == null || uploadResult.code != 200) { @@ -288,15 +279,16 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity) } //被动上报埋点统计 + val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() BadCaseAnalyticsManager.bagRecordUpload(recordKey?:"",recordFileName?:"",receiveTime?:System.currentTimeMillis().toString(), stat,AppConfigInfo.plateNumber,BadCaseConfig.totalDuration.toString(),MoGoAiCloudClientConfig.getInstance().sn, - BadCaseConfig.dockerVersion ?:"",AppUtils.getAppVersionName(),latitude.toString(),longitude.toString(), + BadCaseConfig.dockerVersion ?:"",AppUtils.getAppVersionName(),loc.latitude.toString(),loc.longitude.toString(), BadCaseConfig.identity,downloadUrl?:"",uploadReason,System.currentTimeMillis().toString(),"0") //日志 CallerLogger.i("$M_DEVA$TAG", "BadCase Passive Analytics="+"key="+recordKey+" filename="+recordFileName+ " receiveTime="+receiveTime+" stat="+"100"+" plateNumber="+AppConfigInfo.plateNumber+ " totalDuration="+ BadCaseConfig.totalDuration +" carSn="+MoGoAiCloudClientConfig.getInstance().sn+" mapVersion="+BadCaseConfig.dockerVersion+ - " eyeVersion="+AppUtils.getAppVersionName()+" latitude="+ latitude +" longitude="+ longitude+ + " eyeVersion="+AppUtils.getAppVersionName()+" latitude="+ loc.latitude +" longitude="+ loc.longitude+ " identity="+BadCaseConfig.identity + " downloadUrl="+downloadUrl +" uploadReason="+uploadReason+ " uploadTime="+System.currentTimeMillis()+" channel="+"0") BadCaseConfig.windowNum-- @@ -390,7 +382,6 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene fun hideFloatWindow() { // 移除 ADAS车辆状态&定位 监听 - CallerChassisLocationWGS84ListenerManager.removeListener(TAG) if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout) } @@ -411,9 +402,4 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene fun closeWindow() } - override fun onChassisLocationWGS84(gnssInfo: MogoLocation) { - latitude = gnssInfo.latitude - longitude = gnssInfo.longitude - } - } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt index 6b9250da1c..f01abd657c 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt @@ -46,28 +46,26 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo } override fun onChassisLocationWGS84(gnssInfo: MogoLocation) { - if (gnssInfo != null) { - //设置刹车信息,小于默认认为是刹车 //todo 优化sp获取,不要每次回调都去调用sp - brakeLight = - if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat( - MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f - ) - ) { - 1 - } else { - 0 - } - CallerLogger.d( - "$M_HMI$TAG", - "---onAutopilotLightSwitchData ---Acceleration = " + gnssInfo.acceleration + "-- brakeLight = " + brakeLight - ) - ThreadUtils.runOnUiThread { - if (!isShowTurnLight) { //在不展示转向灯的情况下,展示车辆刹车的动效 - brakeView.visibility = View.VISIBLE - brakeView.setBrakeLight(brakeLight) - } else { - brakeView.visibility = View.GONE - } + //设置刹车信息,小于默认认为是刹车 //todo 优化sp获取,不要每次回调都去调用sp + brakeLight = + if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat( + MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f + ) + ) { + 1 + } else { + 0 + } + CallerLogger.d( + "$M_HMI$TAG", + "---onAutopilotLightSwitchData ---Acceleration = " + gnssInfo.acceleration + "-- brakeLight = " + brakeLight + ) + ThreadUtils.runOnUiThread { + if (!isShowTurnLight) { //在不展示转向灯的情况下,展示车辆刹车的动效 + brakeView.visibility = View.VISIBLE + brakeView.setBrakeLight(brakeLight) + } else { + brakeView.visibility = View.GONE } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt index 9a83acc88a..d20111f2dd 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt @@ -9,13 +9,11 @@ import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.deva.bindingcar.AdUpgradeStateHelper import com.mogo.eagle.core.data.deva.bindingcar.IPCUpgradeStateInfo -import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84 import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager @@ -42,7 +40,7 @@ class SystemVersionView @JvmOverloads constructor( attrs: AttributeSet? = null, defStyleAttr: Int = 0 ) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener, - IMoGoDevaToolsListener, IMoGoCheckAutoPilotBtnListener, IMoGoChassisLocationWGS84Listener { + IMoGoDevaToolsListener, IMoGoCheckAutoPilotBtnListener { companion object { const val TAG = "SystemVersionView" @@ -57,7 +55,6 @@ class SystemVersionView @JvmOverloads constructor( private var currentProgress: Int = -1 //当前已下载包体大小 private var isHDCached = false - private var location: MogoLocation? = null init { LayoutInflater.from(context).inflate(R.layout.view_system_version, this, true) @@ -141,17 +138,17 @@ class SystemVersionView @JvmOverloads constructor( ivHDCache.setOnClickListener { hmiAction( "$M_HMI$TAG", - "HD map view click , isHDCached:$isHDCached , lon:${location?.longitude} , lat:${location?.latitude}" + "HD map view click , isHDCached:$isHDCached , lon:${getChassisLocationWGS84().longitude} , lat:${getChassisLocationWGS84().latitude}" ) if (isHDCached) {// 已缓存 ToastUtils.showShort(resources.getString(R.string.offline_had_downloaded)) } else {// 未缓存 if (CallerMapUIServiceManager.getCityCode().isNullOrEmpty()) {// 未拿到高德的cityCode - if (location == null || (location!!.longitude <= 0.0 && location!!.latitude <= 0.0)) {// 未拿到高精的经纬度 + if ((getChassisLocationWGS84().longitude <= 0.0 && getChassisLocationWGS84().latitude <= 0.0)) {// 未拿到高精的经纬度 ToastUtils.showShort(resources.getString(R.string.location_try_again)) } else {// 拿到了高精的经纬度 val dialog = OfflineMapDialog(context) - dialog.location = location + dialog.location = getChassisLocationWGS84() dialog.show() } } else {// 拿到高德的cityCode @@ -313,7 +310,6 @@ class SystemVersionView @JvmOverloads constructor( CallerHmiListenerManager.addListener(TAG, this) CallerAutoPilotStatusListenerManager.addListener(TAG, this) CallerDevaToolsListenerManager.addListener(TAG, this) - CallerChassisLocationWGS84ListenerManager.addListener(TAG, this) needQueryContainers = true } @@ -325,7 +321,6 @@ class SystemVersionView @JvmOverloads constructor( CallerHmiListenerManager.removeListener(TAG) CallerAutoPilotStatusListenerManager.removeListener(TAG) CallerDevaToolsListenerManager.removeListener(TAG) - CallerChassisLocationWGS84ListenerManager.removeListener(TAG) needQueryContainers = false } @@ -368,10 +363,6 @@ class SystemVersionView @JvmOverloads constructor( adCircularProgressView?.visibility = View.GONE } - override fun onChassisLocationWGS84(gnssInfo: MogoLocation) { - location = gnssInfo - } - /** * 状态查询应答 * @param status 数据 diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/SpeedLimitDataManager.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/SpeedLimitDataManager.java index 10b3e6f4a6..cb05dabf49 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/SpeedLimitDataManager.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/SpeedLimitDataManager.java @@ -1,10 +1,8 @@ package com.mogo.eagle.core.function.business; -import androidx.annotation.Nullable; import com.mogo.eagle.core.data.enums.DataSourceType; import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener; import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager; import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager; import com.mogo.map.MapDataWrapper; @@ -12,19 +10,14 @@ import com.mogo.map.MapDataWrapper; import java.util.Timer; import java.util.TimerTask; -import kotlin.Unit; -import kotlin.jvm.functions.Function1; - /** * 限速 * * @author mogoauto */ -public class SpeedLimitDataManager implements IMoGoChassisLocationWGS84Listener { +public class SpeedLimitDataManager { - private final static String TAG = "SpeedLimitDataManager"; private static volatile SpeedLimitDataManager instance; - private volatile MogoLocation mLocation; private SpeedLimitDataManager() { } @@ -40,34 +33,26 @@ public class SpeedLimitDataManager implements IMoGoChassisLocationWGS84Listener return instance; } - @Override - public void onChassisLocationWGS84(@Nullable MogoLocation gnssInfo) { - mLocation = gnssInfo; - } - - private class SpeedTimerTask extends TimerTask { + private static class SpeedTimerTask extends TimerTask { @Override public void run() { - if (mLocation != null) { - getSpeedLimit(); - } + getSpeedLimit(); } private void getSpeedLimit() { - MapDataWrapper.INSTANCE.getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), (float) mLocation.getHeading(), new Function1() { - @Override - public Unit invoke(Integer integer) { + MogoLocation loc = CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84(); + if (loc.getLatitude() > 0 && loc.getLongitude() > 0) { + MapDataWrapper.INSTANCE.getLimitSpeed(loc.getLongitude(), loc.getLatitude(), (float) loc.getHeading(), integer -> { if (integer != null && integer > 0) { CallerLimitingVelocityListenerManager.INSTANCE.invokeUnion(integer, DataSourceType.MAP); } return null; - } - }); + }); + } } } public void start() { - CallerChassisLocationWGS84ListenerManager.INSTANCE.addListener(TAG, this); Timer mTimer = new Timer(); mTimer.schedule(new SpeedTimerTask(), 3000, 1000); } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/MogoRouteOverlayManager.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/MogoRouteOverlayManager.java index 9f022ffb9e..b255d37baf 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/MogoRouteOverlayManager.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/MogoRouteOverlayManager.java @@ -75,18 +75,18 @@ public class MogoRouteOverlayManager implements if (gnssInfo == null) { return; } - Log.d(TAG, "-- onChassisLocationGCJ02 -- 1 ---" + ":auto-mode:" + autopilotMode.get() + ", isArriveAtStation: " + isArriveAtStation.get()); +// Log.d(TAG, "-- onChassisLocationGCJ02 -- 1 ---" + ":auto-mode:" + autopilotMode.get() + ", isArriveAtStation: " + isArriveAtStation.get()); if (isArriveAtStation.get() && autopilotMode.get() != 2) { RouteOverlayDrawer.getInstance().clearMogoRouteOverlay(); return; } - Log.d(TAG, "-- onChassisLocationGCJ02 -- 2 ---" + "auto-mode:" + autopilotMode.get() + ", isDemoMode:" + FunctionBuildConfig.isDemoMode + ", force:" + FunctionBuildConfig.isForceDrawAutopilotTrajectoryByDebugSettingView); +// Log.d(TAG, "-- onChassisLocationGCJ02 -- 2 ---" + "auto-mode:" + autopilotMode.get() + ", isDemoMode:" + FunctionBuildConfig.isDemoMode + ", force:" + FunctionBuildConfig.isForceDrawAutopilotTrajectoryByDebugSettingView); boolean force = FunctionBuildConfig.isForceDrawAutopilotTrajectoryByDebugSettingView || FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData; if (!force && autopilotMode.get() != 2) { RouteOverlayDrawer.getInstance().clearMogoRouteOverlay(); return; } - Log.d(TAG, "-- onChassisLocationGCJ02 -- 3 ---"); +// Log.d(TAG, "-- onChassisLocationGCJ02 -- 3 ---"); synchronized (queue) { if (!queue.isEmpty()) { List items = queue.pollLast(); diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt index 771ad6c73b..afa697169d 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt @@ -102,6 +102,7 @@ class ChainConstant { const val CHAIN_CODE_V2X_MSG = "CHAIN_CODE_V2X_MSG" const val CHAIN_CODE_MSG_BOX = "CHAIN_CODE_MSG_BOX" const val CHAIN_CODE_HD_MAP_CALL = "CHAIN_CODE_HD_MAP_CALL" + const val CHAIN_CODE_HD_MAP_ROAD_CROSS = "CHAIN_CODE_HD_MAP_ROAD_CROSS" const val CHAIN_CODE_HMI_ACTIONS = "CHAIN_CODE_HMI_ACTIONS" //operation by user diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRoadListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRoadListenerManager.kt index c7362178d4..b5821f9260 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRoadListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRoadListenerManager.kt @@ -1,7 +1,11 @@ package com.mogo.eagle.core.function.call.map -import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.data.deva.chain.ChainConstant +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP +import com.zhidaoauto.map.data.road.RoadCross import com.zhidaoauto.map.data.road.StopLine +import com.zhjt.service.chain.ChainLog import java.util.concurrent.ConcurrentHashMap import kotlin.properties.Delegates @@ -9,11 +13,11 @@ object CallerMapRoadListenerManager { interface OnRoadListener { - fun onRoadIdInfo(roadId: String){} + fun onRoadIdInfo(roadId: String) {} - fun onStopLineInfo(info: StopLine){} + fun onStopLineInfo(info: StopLine) {} - fun onRoadChange(cross: Boolean){} + fun onRoadChange(cross: Boolean) {} } private val listeners by lazy { @@ -48,15 +52,21 @@ object CallerMapRoadListenerManager { } private var mCross: Boolean by Delegates.observable(false) { _, oldValue, newValue -> - if(oldValue != newValue){ - Logger.d("emArrow","cross : $newValue") + if (oldValue != newValue) { + CallerLogger.d("$M_MAP onRoadChange", newValue) listeners.forEach { entry -> entry.value.onRoadChange(newValue) } } } - fun invokeRoadChange(cross: Boolean) { + @ChainLog( + linkChainLog = ChainConstant.CHAIN_TYPE_HD_MAP, + linkCode = ChainConstant.CHAIN_SOURCE_MAP, + nodeAliasCode = ChainConstant.CHAIN_CODE_HD_MAP_ROAD_CROSS, + paramIndexes = [0, 1] + ) + fun invokeRoadChange(cross: Boolean, roadCross: RoadCross) { mCross = cross } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt index 2a4695915a..2a4710d8bb 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt @@ -207,18 +207,18 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle } } - private var roadCross:RoadCross? by Delegates.observable(null){ _,oldValue,newValue -> + private var roadCross: RoadCross? by Delegates.observable(null) { _, oldValue, newValue -> oldValue?.let { //对驶入驶出路口做二次过滤,防止多次回调 - if(it.status == 0 && newValue!!.status == 1){ + if (it.status == 0 && newValue!!.status == 1) { //进入路口 - i("$M_MAP$TAG","进入路口 :${newValue.cross_id}") - invokeRoadChange(true) + i("$M_MAP$TAG", "进入路口 :${newValue.cross_id}") + invokeRoadChange(true, newValue) } - if((it.status == 1 && newValue!!.status == 0) || (newValue!!.cross_id_end.isNotEmpty() && oldValue.cross_id_end != newValue.cross_id_end)){ + if ((it.status == 1 && newValue!!.status == 0) || (newValue!!.cross_id_end.isNotEmpty() && oldValue.cross_id_end != newValue.cross_id_end)) { //驶出路口 - i("$M_MAP$TAG","驶出路口 上个:${oldValue.cross_id_end} , 下个:${newValue.cross_id_end}") - invokeRoadChange(false) + i("$M_MAP$TAG", "驶出路口 上个:${oldValue.cross_id_end} , 下个:${newValue.cross_id_end}") + invokeRoadChange(false, newValue) } } } @@ -232,7 +232,7 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle override fun onStopLineInfo(stopLine: StopLine?) { stopLine?.let { - if(it.road_id.isNotEmpty() && it.points.size > 0){ + if (it.road_id.isNotEmpty() && it.points.size > 0) { d(M_MAP + TAG, "onStopLineInfo: $it") invokeListenersOnStopLineGet(it) } @@ -252,7 +252,7 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle } override fun changeMapVisualAngle(angelMode: VisualAngleMode, mogoLatLng: MogoLatLng?) { - if(visualLock){ + if (visualLock) { e(M_MAP + TAG, "视角切换已锁定") return }