[6.8.0][驾驶位视频流] 代码提交
This commit is contained in:
@@ -31,6 +31,7 @@ import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_DEMO
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_RAIN
|
||||
import com.mogo.eagle.core.function.api.setting.ISopSettingListener
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
|
||||
@@ -41,6 +42,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSopSettingManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.eagle.core.function.call.unmanned.CallerUnmannedListenerManager
|
||||
import com.mogo.eagle.core.function.call.vehicle.CallerSweeperModeListenerManager
|
||||
@@ -59,11 +61,13 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.vehicle.SweeperVehicleConfigUtils
|
||||
import com.mogo.eagle.core.utilcode.rv.divider.CommonDividerItemDecoration
|
||||
import com.mogo.eagle.core.utilcode.util.AppStateManager
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils.*
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
import com.zhjt.mogo.adas.data.bean.AdasParam
|
||||
import kotlinx.android.synthetic.main.layout_operate_panel.view.iv_operate_panel_close
|
||||
import kotlinx.android.synthetic.main.layout_operate_panel_preference_widget_switch_compat.switchWidget
|
||||
import kotlinx.coroutines.launch
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import mogo.telematics.pad.MessagePad
|
||||
@@ -669,9 +673,10 @@ class OperatePanelLayout : LinearLayout {
|
||||
}
|
||||
}
|
||||
|
||||
class BusinessPreferenceFragmentCompat : OperatePanelDetailBase() {
|
||||
class BusinessPreferenceFragmentCompat : OperatePanelDetailBase(), IReceivedMsgListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "BusinessPreferenceFragmentCompat"
|
||||
private const val KEY_FAULT_REPORT_TIP = "fault_report_tip"
|
||||
private const val KEY_LIMIT_SPEED_MARKER = "limit_speed_marker"
|
||||
private const val KEY_WEATHER_EFFECT_SWITCH = "weather_effect_switch"
|
||||
@@ -680,6 +685,22 @@ class OperatePanelLayout : LinearLayout {
|
||||
private const val KEY_UNMANNED_DEMO_PULL_INTERVAL = "unmanned_demo_pull_interval"
|
||||
private const val KEY_SWEEPER_CLOUD_CONTROL = "sweeper_cloud_control"
|
||||
private const val KEY_LOOK_AROUND_360 = "look_around_360"
|
||||
private const val KEY_DRIVE_SEAT_VIDEO_STREAM = "drive_seat_video_stream"
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
CallerTelematicListenerManager.addListener(TAG, this)
|
||||
lifecycleScope.launchWhenResumed {
|
||||
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(KEY_DRIVE_SEAT_VIDEO_STREAM)?.also {
|
||||
it.isEnabled = CallerDevaToolsManager.driveSeatVideoProvider()?.requestVideoInfo()?.livePlayUrl?.isNotEmpty() ?: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun getDefaultVal(pref: Preference): Any? {
|
||||
@@ -758,6 +779,30 @@ class OperatePanelLayout : LinearLayout {
|
||||
return super.onPreferenceClick(preference)
|
||||
}
|
||||
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
|
||||
if (type == TelematicConstant.DRIVE_SEAT_VIDEO_STREAM_RSP) {
|
||||
val s = String(byteArray)
|
||||
clickEventAnalytics("视频流驾驶位开头-RSP->$s", false)
|
||||
lifecycleScope.launchWhenResumed {
|
||||
when(s) {
|
||||
"01" -> {
|
||||
//关闭成功
|
||||
FunctionBuildConfig.isDriveSeatVideoStream = false
|
||||
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(KEY_DRIVE_SEAT_VIDEO_STREAM)?.also { changeValue(it, false) }
|
||||
}
|
||||
"11" -> {
|
||||
//打开成功
|
||||
FunctionBuildConfig.isDriveSeatVideoStream = true
|
||||
preferenceScreen.findPreferenceReal<SwitchPreferenceCompat>(KEY_DRIVE_SEAT_VIDEO_STREAM)?.also { changeValue(it, true) }
|
||||
}
|
||||
else -> {
|
||||
//关闭失败或打开失败
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
|
||||
when (preference.key) {
|
||||
KEY_FAULT_REPORT_TIP -> {
|
||||
@@ -848,6 +893,15 @@ class OperatePanelLayout : LinearLayout {
|
||||
clickEventAnalytics("清扫云控业务", isChecked)
|
||||
return true
|
||||
}
|
||||
KEY_DRIVE_SEAT_VIDEO_STREAM -> {
|
||||
val isChecked = newValue as? Boolean ?: false
|
||||
clickEventAnalytics("视频流驾驶位开关", isChecked)
|
||||
val map = HashMap<String, String>()
|
||||
map["open"] = if (isChecked) "1" else "0"
|
||||
map["playUrl"] = CallerDevaToolsManager.driveSeatVideoProvider()?.getLastData()?.livePlayUrl ?: ""
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.DRIVE_SEAT_VIDEO_STREAM_REQ, toJson(map).toByteArray())
|
||||
return false
|
||||
}
|
||||
}
|
||||
return super.onPreferenceChange(preference, newValue)
|
||||
}
|
||||
|
||||
@@ -51,5 +51,12 @@
|
||||
android:title="360环视"
|
||||
android:persistent="false"
|
||||
android:widgetLayout="@layout/layout_operate_panel_preference_widget_switch_compat" />
|
||||
<SwitchPreferenceCompat
|
||||
android:key="drive_seat_video_stream"
|
||||
android:layout="@layout/layout_operate_panel_preference_switch_compat"
|
||||
android:title="驾驶位视频流"
|
||||
android:persistent="false"
|
||||
android:enabled="false"
|
||||
android:widgetLayout="@layout/layout_operate_panel_preference_widget_switch_compat" />
|
||||
</PreferenceCategory>
|
||||
</androidx.preference.PreferenceScreen>
|
||||
Reference in New Issue
Block a user