diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerBaseFragment.java b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerBaseFragment.java index fa686d846f..a14085ab59 100644 --- a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerBaseFragment.java +++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerBaseFragment.java @@ -22,6 +22,7 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.och.bus.passenger.R; import com.mogo.och.bus.passenger.constant.BusPassengerConst; import com.mogo.och.common.module.utils.NumberFormatUtil; +import com.mogo.och.common.module.wigets.OCHBorderShadowLayout; /** * Created on 2022/3/31 @@ -39,6 +40,8 @@ public abstract class BusPassengerBaseFragment + + + + + + + + + + + + 55dp 40dp + 495dp + 309dp + 584dp 550dp \ No newline at end of file diff --git a/app/productFlavors/fPadLenovoOchBusPassenger.gradle b/app/productFlavors/fPadLenovoOchBusPassenger.gradle index aa50f49580..97b39ec2b2 100644 --- a/app/productFlavors/fPadLenovoOchBusPassenger.gradle +++ b/app/productFlavors/fPadLenovoOchBusPassenger.gradle @@ -43,7 +43,7 @@ project.android.productFlavors { buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'true' // 构建 是否支持多屏异显异交互 - buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'true' + buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'false' //Bus不能启动自驾的档位 buildConfigField 'java.util.Set', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet(){{add(chassis.Chassis.GearPosition.GEAR_N);add(chassis.Chassis.GearPosition.GEAR_R);}}' diff --git a/app/productFlavors/fPadLenovoOchTaxiPassenger.gradle b/app/productFlavors/fPadLenovoOchTaxiPassenger.gradle index 5c37382209..cb943e5571 100644 --- a/app/productFlavors/fPadLenovoOchTaxiPassenger.gradle +++ b/app/productFlavors/fPadLenovoOchTaxiPassenger.gradle @@ -45,7 +45,7 @@ project.android.productFlavors { buildConfigField 'boolean', 'IS_CAR_MODEL_CHANGE', 'true' // 构建 是否支持多屏异显异交互 - buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'true' + buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'false' //Taxi不能启动自驾的档位 buildConfigField 'java.util.Set', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet(){{add(chassis.Chassis.GearPosition.GEAR_P);add(chassis.Chassis.GearPosition.GEAR_R);}}' diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/DriverMonitorView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/DriverMonitorView.kt new file mode 100644 index 0000000000..58afe8435b --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/DriverMonitorView.kt @@ -0,0 +1,204 @@ +package com.mogo.eagle.core.function.hmi.ui.widget + +import android.app.Application +import android.content.Context +import android.os.Handler +import android.util.AttributeSet +import android.view.LayoutInflater +import com.mogo.cloud.live.manager.LiveStreamManagerImpl +import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.cloud.trafficlive.api.ITrafficCarLiveCallBack +import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive +import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant +import com.mogo.eagle.core.widget.RoundConstraintLayout +import kotlinx.android.synthetic.main.view_camera_list.view.* +import kotlinx.android.synthetic.main.view_driver_monitor.view.* + +/** + * 乘客端查看当前车辆驾驶舱的司机监控View + */ +class DriverMonitorView : + RoundConstraintLayout { + companion object { + private val TAG = "DriverMonitorView" + private var isLived = false + + // TODO SOP演示功能代码,乘客端查看当前车辆上的司机位置监控,请求的是分体机提供的直播信息,这里采用的是硬编码,因为云平台的操作就是这样,没有接口供查询对应关系 + private var sopShowDriverMap = HashMap() + } + + private val mHandler = Handler() + private val mRunnable = object : Runnable { + override fun run() { + // Do something here + Logger.d( + "${SceneConstant.M_HMI}$TAG", + "检查司机直播……isLived=$isLived 当前车上的司机端SN=${sopShowDriverMap[CallerTelematicManager.getServerToken()]}" + ) + CallerLogger.d( + "${SceneConstant.M_HMI}$TAG", + "检查司机直播……isLived=$isLived 当前车上的司机端SN=${sopShowDriverMap[CallerTelematicManager.getServerToken()]}" + ) + showLive() + + mHandler.postDelayed(this, 10000) // 1 second delay + } + } + + private val liveStreamManager by lazy { + LiveStreamManagerImpl.getInstance( + context.applicationContext as Application?, + MoGoAiCloudClientConfig.getInstance().sn, + false + ) + } + + constructor(context: Context?) : super(context) { + initView(context) + } + + constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) { + initView(context) + } + + constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super( + context, + attrs, + defStyleAttr + ) { + initView(context) + } + + private fun initView(context: Context?) { + LayoutInflater.from(context) + .inflate(R.layout.view_driver_monitor, this, true) + + textureViewDriverMonitor.isOpaque = false + + liveStreamManager.setLiveStatusChangeCallback { + textureView + .post { + handleSnLiveStatus(it) + } + } + + // TODO SOP演示需求,只有乘客屏幕才会触发这个逻辑 begin + // 测试数据 + sopShowDriverMap["X202022060289M7N8P"] = "F803EB2046PZD00188"//湘A01733D + // key=pad司机屏幕SN,value=分体机SN,value用来调用ZeGo直播服务查看直播,@see MoGoAiCloudTrafficLive.viewDesignativeVehicleLive + sopShowDriverMap["20220524733SWT1"] = "F803EB2046PZD00190"//湘D01777D + sopShowDriverMap["20211110K7EJKPG"] = "F803EB2046PZD00188"//湘A01733D + sopShowDriverMap["20211120H342O9Z"] = "F803EB2046PZD00167"//未知 + sopShowDriverMap["20211112X2RI32A"] = "F803EB2046PZD00274"//京A40776D + sopShowDriverMap["202204085X310A1"] = "F803EB2046PZD00263"//湘D09005D + + // TODO SOP演示需求,只有乘客屏幕才会触发这个逻辑 END + // 点击重新连接直播 + ivNormal.setOnClickListener { + showLive() + } + + mHandler.postDelayed(mRunnable, 1000) // 1 second delay + } + + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + mHandler.removeCallbacks(mRunnable) + sopShowDriverMap[CallerTelematicManager.getServerToken()]?.let { + MoGoAiCloudTrafficLive.stopCarLive(it) + } + } + + fun showLive() { + if (!isLived) { + sopShowDriverMap[CallerTelematicManager.getServerToken()]?.let { + Logger.d( + "${SceneConstant.M_HMI}$TAG", + "检查司机直播……isLived=$isLived 当前车上的司机端SN=${sopShowDriverMap[CallerTelematicManager.getServerToken()]}" + ) + CallerLogger.d( + "${SceneConstant.M_HMI}$TAG", + "检查司机直播……isLived=$isLived 当前车上的司机端SN=${sopShowDriverMap[CallerTelematicManager.getServerToken()]}" + ) + MoGoAiCloudTrafficLive.viewDesignativeVehicleLive( + it, + textureViewDriverMonitor, + carLiveCallBack + ) + } +// MoGoAiCloudTrafficLive.viewDesignativeVehicleLive( +// "F803EB2046PZD00190", +// textureViewDriverMonitor, +// carLiveCallBack +// ) + } + } + + private fun refreshView(lived: Boolean) { + if (lived) { + textureViewDriverMonitor.visibility = VISIBLE + liveProgressBar.visibility = GONE + tvLoadingHit.visibility = GONE + } else { + textureViewDriverMonitor.visibility = GONE + liveProgressBar.visibility = VISIBLE + tvLoadingHit.visibility = VISIBLE + } + } + + private fun handleSnLiveStatus(status: Int) { + when (status) { + 0 -> {// 正在直播 + isLived = true + } + + 1 -> {// 直播已停止 + isLived = false + } + + 2 -> {// 直播强制结束 + isLived = false + } + } + refreshView(isLived) + + Logger.d("${SceneConstant.M_HMI}$TAG", "isLived:$isLived") + CallerLogger.d("${SceneConstant.M_HMI}$TAG", "isLived:$isLived") + } + + private val carLiveCallBack = object : ITrafficCarLiveCallBack { + override fun onLive(liveSn: String?) { + Logger.d("${SceneConstant.M_HMI}$TAG", "onLive:$liveSn") + CallerLogger.d("${SceneConstant.M_HMI}$TAG", "onLive:$liveSn") + isLived = true + refreshView(isLived) + } + + override fun onFirstFrame() { + Logger.d("${SceneConstant.M_HMI}$TAG", "onFirstFrame:isFirstPage") + CallerLogger.d("${SceneConstant.M_HMI}$TAG", "onFirstFrame:isFirstPage") + isLived = true + refreshView(isLived) + } + + override fun onDisConnect() { + Logger.e("${SceneConstant.M_HMI}$TAG", "onDisConnect") + CallerLogger.e("${SceneConstant.M_HMI}$TAG", "onDisConnect") + isLived = false + refreshView(isLived) + } + + override fun onError(errorMsg: String?) { + Logger.e("${SceneConstant.M_HMI}$TAG", "onError msg is:${errorMsg}") + CallerLogger.e("${SceneConstant.M_HMI}$TAG", "onError msg is:${errorMsg}") + isLived = false + refreshView(isLived) + } + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bus_picture_nor.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bus_picture_nor.png new file mode 100644 index 0000000000..45ae53aa8b Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bus_picture_nor.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/icon_loading_live.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/icon_loading_live.png new file mode 100644 index 0000000000..df4c5965c1 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/icon_loading_live.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_driver_monitor.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_driver_monitor.xml new file mode 100644 index 0000000000..11cbf18902 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_driver_monitor.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + \ No newline at end of file