From 73012df18bac70f98076b126de72fcc7d21f71e0 Mon Sep 17 00:00:00 2001 From: yangyakun Date: Thu, 21 Nov 2024 10:53:41 +0800 Subject: [PATCH] =?UTF-8?q?[6.8.0]=20[fea]=20[=E8=BD=A6=E5=A4=96=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E9=9F=B3=E9=A2=91]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OchAutoPilotStatusListenerManager.kt | 5 +- .../manager/autopilot/line/ILineCallback.java | 7 ++- .../manager/autopilot/line/LineManager.kt | 9 +++- .../och/common/module/voice/VoiceNotice.kt | 8 +++ .../wigets/autopilot/AutopilotStateModel.kt | 5 +- .../com/mogo/och/weaknet/constant/BusConst.kt | 2 + .../com/mogo/och/weaknet/model/OrderModel.kt | 52 +++++++++++++++++++ .../mogo/och/weaknet/model/ThirdDeviceData.kt | 4 ++ .../och/weaknet/ui/fragment/BusPresenter.kt | 17 +----- .../och/weaknet/util/ShuttleVoiceManager.kt | 6 +++ .../src/main/res/values/strings.xml | 5 ++ 11 files changed, 99 insertions(+), 21 deletions(-) diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutoPilotStatusListenerManager.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutoPilotStatusListenerManager.kt index cb3c94be6f..09567dab40 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutoPilotStatusListenerManager.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutoPilotStatusListenerManager.kt @@ -10,7 +10,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerFsm2024ListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerReceiveReceivedAckListenerManager import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.util.StringUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.och.common.module.R @@ -279,6 +278,10 @@ object OchAutoPilotStatusListenerManager : CallerBase() { ) M_LISTENERS.forEach { - it.value.startAutopilotSuccess() + it.value.sendStartAutopilotSuccess() } } @@ -533,4 +534,10 @@ object LineManager : CallerBase() { } } + fun invokeStartAutopilotAckSuccess(receivedAck: ReceivedAck) { + M_LISTENERS.forEach { + it.value.sendStartAutopilotSuccessAck() + } + } + } \ No newline at end of file diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/voice/VoiceNotice.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/voice/VoiceNotice.kt index 0e3c4182fa..e1625c4f39 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/voice/VoiceNotice.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/voice/VoiceNotice.kt @@ -21,6 +21,14 @@ object VoiceNotice { showNotice(notice, AIAssist.LEVEL0) } + @JvmStatic + fun showNoticeOut(notice: String?) { + save2Log("车外准备播放 内容${notice}") + notice?.let { + AIAssist.getInstance(AbsMogoApplication.getApp()).playVoiceOutside(notice) + } + } + @JvmStatic fun showNotice(notice: String?, level: Int) { showNotice(notice,level,0) diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/autopilot/AutopilotStateModel.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/autopilot/AutopilotStateModel.kt index 22cc906d09..38e889137b 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/autopilot/AutopilotStateModel.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/autopilot/AutopilotStateModel.kt @@ -7,7 +7,6 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler import com.mogo.och.common.module.debug.autopilot.AutopilotStateDebug import com.mogo.och.common.module.debug.autopilot.IOchDebugAutopilotStatusListener import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener -import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager import com.mogo.och.common.module.manager.autopilot.line.ILineCallback import com.mogo.och.common.module.manager.autopilot.line.LineManager @@ -132,7 +131,7 @@ class AutopilotStateModel : ViewModel(), IOchAutopilotStatusListener, ILineCall fun startAutopilot() { OchChainLogManager.writeChainLog("自驾信息","启动自驾") if(AutopilotStateDebug.debugStatus){ - startAutopilotSuccess() + sendStartAutopilotSuccess() RxUtils.createSubscribe(5_000) { startAutopilotFail() } @@ -144,7 +143,7 @@ class AutopilotStateModel : ViewModel(), IOchAutopilotStatusListener, ILineCall /** * 条件过滤完成 正式进入启动自驾状态 */ - override fun startAutopilotSuccess() { + override fun sendStartAutopilotSuccess() { OchChainLogManager.writeChainLog("自驾信息","启动自驾成功") BizLoopManager.runInMainThread { this.viewCallback?.startAutopilotAnimation() diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/constant/BusConst.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/constant/BusConst.kt index 18b1fb1f31..a0f7df044d 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/constant/BusConst.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/constant/BusConst.kt @@ -23,6 +23,8 @@ class BusConst { // 尝试下发给MEC轨迹最多10次 const val LOOP_SEND_TRAJ_TIMES = 10 + const val SEND_OUTVOICE_DISTANCES_TARTSTATIONE = 15 + //起点UUID const val BUS_START_MAP_MAKER = "bus_start_map_maker"; //终点UUID diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/OrderModel.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/OrderModel.kt index 865c646471..13eb90673a 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/OrderModel.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/OrderModel.kt @@ -10,14 +10,20 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS +import com.mogo.eagle.core.utilcode.util.CoordinateUtils import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.eagle.core.utilcode.util.UiThreadHandler import com.mogo.och.common.module.biz.login.LoginStatusManager +import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener +import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation import com.mogo.och.common.module.manager.autopilot.line.ILineCallback import com.mogo.och.common.module.manager.autopilot.line.LineManager +import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager +import com.mogo.och.common.module.manager.loop.BizLoopManager +import com.mogo.och.common.module.manager.loop.LoopInfo import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager import com.mogo.och.common.module.manager.socket.lan.LedScreenManager import com.mogo.och.common.module.manager.transform.OchTransform @@ -39,6 +45,7 @@ import io.reactivex.Observer import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.disposables.Disposable import io.reactivex.schedulers.Schedulers +import mogo_msg.MogoReportMsg.MogoReportMessage /** * @author congtaowang @@ -71,6 +78,7 @@ object OrderModel { // 加载核销模块 TicketModel.load() + OchAutoPilotStatusListenerManager.addListener(TAG, ochAutopilotStatusListener) LineManager.addListener(TAG,arriveStationBySearch) @@ -89,10 +97,26 @@ object OrderModel { TicketModel.release() + OchAutoPilotStatusListenerManager.removeListener(TAG) + LineManager.removeListener(TAG) OchTransform.removeListener(TAG) } + private val ochAutopilotStatusListener = object : IOchAutopilotStatusListener{ + override fun onAutopilotArriveAtStation(arrivedStation: ArrivedStation?) { + e(M_BUS + TAG, "行程日志-onAutopilotArriveAtStation arrive") + onArriveAt(arrivedStation, "底盘触发进站") + } + + + override fun onAutopilotGuardian(guardianInfo: MogoReportMessage, lineId: Long) { + BusTrajectoryManager.getInstance().onAutopilotGuardian(guardianInfo, lineId) + } + + + } + private val ochTransform = object : OchTransformDispatch { override fun logout() { logoutInner() @@ -110,6 +134,34 @@ object OrderModel { } } } + + override fun sendStartAutopilotSuccessAck() { + //底盘收到启动自驾的回执 + BizLoopManager.setLoopFunction(TAG, LoopInfo(2, ::calculateDistanceAndAutoStatus,scheduler = Schedulers.io())) + } + } + // 在站点15m内且启动自动驾驶成功后播报,每次启动仅播报1次 + private fun calculateDistanceAndAutoStatus() { + val (start, end) = LineManager.getStations() + if(start==null){ + BizLoopManager.removeLoopFunction(TAG) + }else{ + val startLon = start.gcjLon + val startLat = start.gcjLat + val mogoLocation = OchLocationManager.getGCJ02Location() + val distance = CoordinateUtils.calculateLineDistance( + startLon, startLat, + mogoLocation.longitude, mogoLocation.latitude + ) + if (distance < BusConst.SEND_OUTVOICE_DISTANCES_TARTSTATIONE) { + if(OchAutoPilotStatusListenerManager.autopilotState==IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){ + ShuttleVoiceManager.arrivedStationOut(ResourcesUtils.getString(R.string.m2_voice_out_autopilot_start_in15m)) + BizLoopManager.removeLoopFunction(TAG) + } + }else{ + BizLoopManager.removeLoopFunction(TAG) + } + } } diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/ThirdDeviceData.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/ThirdDeviceData.kt index 3dddd7cb5c..1c61f8f5ed 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/ThirdDeviceData.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/ThirdDeviceData.kt @@ -16,8 +16,10 @@ import com.mogo.och.common.module.manager.socket.lan.LedScreenManager import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg +import com.mogo.och.common.module.utils.ResourcesUtils import com.mogo.och.data.bean.BusRoutesResult import com.mogo.och.data.bean.BusTransferData +import com.mogo.och.shuttle.weaknet.R import com.mogo.och.weaknet.constant.BusConst import com.mogo.och.weaknet.util.ShuttleVoiceManager @@ -92,6 +94,8 @@ object ThirdDeviceData { } LineManager.getStationsWithLine { start, end, lineInfo -> ShuttleVoiceManager.arrivedStationBus(end.name, end.nameKr) + // 收到正在进站的决策信息时播报,每个站点仅播报1次 + ShuttleVoiceManager.arrivedStationOut(ResourcesUtils.getString(R.string.m2_voice_out_arrive_station)) //给bus外屏发送 LedScreenManager.sendTripInfo2Led( LedScreenManager.ARRIVE_STATION, diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/fragment/BusPresenter.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/fragment/BusPresenter.kt index 6b1f712870..ec938a5400 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/fragment/BusPresenter.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/fragment/BusPresenter.kt @@ -23,8 +23,7 @@ import mogo_msg.MogoReportMsg.MogoReportMessage * * @author tongchenfei */ -class BusPresenter(view: ShuttleFragment?) : Presenter(view), - IOchAutopilotStatusListener, ILoginCallback { +class BusPresenter(view: ShuttleFragment?) : Presenter(view), ILoginCallback { init { //2021.11.1 鹰眼架构整合,由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口 @@ -44,27 +43,15 @@ class BusPresenter(view: ShuttleFragment?) : Presenter(view), } fun initModelListener() { - OchAutoPilotStatusListenerManager.addListener(TAG, this) LoginStatusManager.addListener(TAG, this) } fun releaseListener() { OCHAdasAbilityManager.getInstance().release() - OchAutoPilotStatusListenerManager.removeListener(TAG) + LoginStatusManager.removeListener(TAG) } - override fun onAutopilotArriveAtStation(arrivedStation: ArrivedStation?) { - e(SceneConstant.M_BUS + TAG, "行程日志-onAutopilotArriveAtStation arrive") - OrderModel.onArriveAt(arrivedStation, "底盘触发进站") - } - - - - override fun onAutopilotGuardian(guardianInfo: MogoReportMessage, lineId: Long) { - BusTrajectoryManager.getInstance().onAutopilotGuardian(guardianInfo, lineId) - } - override fun onStatusChange(currentStatus: LoginStatusEnum) { d(SceneConstant.M_BUS + TAG, " loginStatus =" + isLogin()) if (isLogin()) { diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/util/ShuttleVoiceManager.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/util/ShuttleVoiceManager.kt index 29cd0a8ce0..6c5113d6f4 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/util/ShuttleVoiceManager.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/util/ShuttleVoiceManager.kt @@ -15,6 +15,12 @@ import com.mogo.tts.base.LanguageType object ShuttleVoiceManager { + fun arrivedStationOut(notice:String?){ + if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) { + VoiceNotice.showNoticeOut(notice) + } + } + fun arrivedStationBus(siteNameCN: String?, siteNameKR: String?) { val context = AbsMogoApplication.getApp() val list: MutableList = ArrayList() diff --git a/OCH/shuttle/driver_weaknet/src/main/res/values/strings.xml b/OCH/shuttle/driver_weaknet/src/main/res/values/strings.xml index f72f9d99eb..172deeef6f 100644 --- a/OCH/shuttle/driver_weaknet/src/main/res/values/strings.xml +++ b/OCH/shuttle/driver_weaknet/src/main/res/values/strings.xml @@ -46,6 +46,11 @@ 确认 取消 + 蘑菇小巴正在进站 + 蘑菇小巴出发咯 + + + 请在网络良好的区域完成任务信息同步后退出 请结束任务后再退出登录