Merge branch 'dev_robotaxi-d_240401_6.4.0' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robotaxi-d_240401_6.4.0
This commit is contained in:
@@ -59,10 +59,10 @@ object LoginLanDriverSocket : ILoginCallback {
|
||||
|
||||
// 司机端发送业务模式更改和环境校验
|
||||
override fun onStatusChange(currentStatus: LoginStatusEnum?) {
|
||||
FlavorUtils.getEnvCheck()
|
||||
if (FlavorUtils.vehicleType != null && FlavorUtils.projectType != null && FlavorUtils.envType != null) {
|
||||
when (currentStatus) {
|
||||
LoginStatusEnum.Login -> {
|
||||
FlavorUtils.getEnvCheck()
|
||||
val msg =
|
||||
ChangeBusinessType(
|
||||
FlavorUtils.vehicleType!!,
|
||||
@@ -77,7 +77,6 @@ object LoginLanDriverSocket : ILoginCallback {
|
||||
BizLoopManager.setLoopFunction(TAG, LoopInfo(60*10, ::loopCheck))
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
BizLoopManager.removeLoopFunction(TAG)
|
||||
val msg =
|
||||
|
||||
@@ -2,12 +2,16 @@ package com.mogo.och.common.module.biz.lansocket
|
||||
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.biz.login.BusinessEnum
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusEnum
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
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.lan.ILanMessageListener
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BaseDPMsg
|
||||
@@ -36,6 +40,24 @@ object LoginLanPassengerSocket : IReceivedMsgListener {
|
||||
}
|
||||
}
|
||||
|
||||
var isConnected:Boolean by Delegates.observable(false) { _, oldV, newV ->
|
||||
if (oldV != newV) {
|
||||
if(newV){// 已连接
|
||||
if(driverSn.isEmpty()){
|
||||
LoginStatusManager.changeStatus("连接成功 未收到司机屏sn")
|
||||
}else{
|
||||
LoginStatusManager.changeStatus("连接成功 司机SN:${driverSn}")
|
||||
}
|
||||
}else{// 未连接
|
||||
if(driverSn.isEmpty()){
|
||||
LoginStatusManager.changeStatus("当前状态:连接司机屏中")
|
||||
}else{
|
||||
LoginStatusManager.changeStatus("连接断开 司机SN:${driverSn}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 环境监测
|
||||
private val checkListener = object : ILanMessageListener<EnvCheck> {
|
||||
override fun target(): Class<EnvCheck> {
|
||||
@@ -94,7 +116,7 @@ object LoginLanPassengerSocket : IReceivedMsgListener {
|
||||
BusinessType.taxi -> LoginStatusManager.setBusinessType(BusinessEnum.Taxi.code)
|
||||
BusinessType.taxiunmanned ->LoginStatusManager.setBusinessType(BusinessEnum.Taxi.code)
|
||||
}
|
||||
status.append(", 后台配置:${LoginStatusManager.getBusInessType().name}>")
|
||||
status.append(", 切换后:${LoginStatusManager.getBusInessType().name}>")
|
||||
LoginStatusManager.changeStatus(status.toString())
|
||||
UiThreadHandler.postDelayed({
|
||||
LoginStatusManager.setLoginStatus(LoginStatusEnum.Login)
|
||||
@@ -113,6 +135,7 @@ object LoginLanPassengerSocket : IReceivedMsgListener {
|
||||
init {
|
||||
//监听司机端消息
|
||||
CallerTelematicListenerManager.addListener(TAG, this)
|
||||
BizLoopManager.setLoopFunction(TAG, LoopInfo(3, ::showConnectStatusWithDriver))
|
||||
// 乘客屏
|
||||
LanSocketManager.registerSocketMessageListener(
|
||||
DPMsgType.TYPE_ENV_CHECK.type,
|
||||
@@ -130,6 +153,11 @@ object LoginLanPassengerSocket : IReceivedMsgListener {
|
||||
|
||||
}
|
||||
|
||||
private fun showConnectStatusWithDriver(){
|
||||
CallerLogger.d(TAG,"司机屏连接状态:${CallerTelematicManager.getClientConnStatus()}")
|
||||
isConnected = CallerTelematicManager.getClientConnStatus()
|
||||
}
|
||||
|
||||
override fun onReceivedServerSn(sn: String?) {
|
||||
Logger.d(TAG, "司机屏sn:$sn")
|
||||
driverSn = sn ?: ""
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.mogo.och.taxi.ui.navi.amap
|
||||
|
||||
import android.os.Bundle
|
||||
import com.amap.api.navi.AMapNaviViewListener
|
||||
import com.mogo.commons.mvp.BaseFragment
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
|
||||
import com.mogo.och.common.module.map.ICommonNaviChangedCallback
|
||||
import com.mogo.och.taxi.R
|
||||
import kotlinx.android.synthetic.main.taxi_amap_navi_view.navi_view
|
||||
|
||||
@@ -15,6 +13,8 @@ import kotlinx.android.synthetic.main.taxi_amap_navi_view.navi_view
|
||||
* @date: 2023/7/24
|
||||
*/
|
||||
class TaxiAmapNaviFragment : BaseFragment(){
|
||||
|
||||
private val TAG = "TaxiAmapNaviFragment"
|
||||
companion object {
|
||||
fun newInstance(): TaxiAmapNaviFragment {
|
||||
val args = Bundle()
|
||||
@@ -36,25 +36,34 @@ class TaxiAmapNaviFragment : BaseFragment(){
|
||||
}
|
||||
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
CallerLogger.e(SceneConstant.M_TAXI + TAG, "initViews")
|
||||
super.initViews(savedInstanceState)
|
||||
if (navi_view != null) navi_view.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
CallerLogger.e(SceneConstant.M_TAXI + TAG, "onResume")
|
||||
super.onResume()
|
||||
if (navi_view != null) navi_view.onResume()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
CallerLogger.e(SceneConstant.M_TAXI + TAG, "onPause")
|
||||
super.onPause()
|
||||
if (navi_view != null) navi_view.onPause()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
override fun onDestroyView() {
|
||||
CallerLogger.e(SceneConstant.M_TAXI + TAG, "onDestroyView")
|
||||
AmapNaviToDestinationModel.getInstance(context).setVoiceIsMute(false)
|
||||
if (navi_view != null) {
|
||||
navi_view.onDestroy()
|
||||
}
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ interface IAutopilotPreLaunchStatus
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
data class SpeedStatus(val speed: Int, var acc: Float): Status(), IAutopilotPreLaunchStatus {
|
||||
data class SpeedStatus(val speed: Int): Status(), IAutopilotPreLaunchStatus {
|
||||
|
||||
override fun isException(): Boolean {
|
||||
return false
|
||||
@@ -306,22 +306,13 @@ data class SpeedStatus(val speed: Int, var acc: Float): Status(), IAutopilotPreL
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as SpeedStatus
|
||||
|
||||
if (speed != other.speed) return false
|
||||
if (acc != other.acc) return false
|
||||
|
||||
return true
|
||||
return speed == other.speed
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = speed.hashCode()
|
||||
result = 31 * result + acc.hashCode()
|
||||
return result
|
||||
return speed.hashCode()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,12 +328,9 @@ data class SteerStatus(val angle: Float, var isError: Boolean = false): Status()
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as SteerStatus
|
||||
|
||||
if (angle != other.angle) return false
|
||||
if (isError != other.isError) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -362,7 +350,7 @@ data class SteerStatus(val angle: Float, var isError: Boolean = false): Status()
|
||||
/**
|
||||
* 油门
|
||||
*/
|
||||
data class AcceleratorStatus(val angle: Float, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus {
|
||||
data class AcceleratorStatus(val angle: Int, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus {
|
||||
|
||||
override fun isException(): Boolean {
|
||||
return isError && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
@@ -394,7 +382,7 @@ data class AcceleratorStatus(val angle: Float, var isError: Boolean = false): St
|
||||
/**
|
||||
* 刹车
|
||||
*/
|
||||
data class BrakeStatus(val angle: Float, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus {
|
||||
data class BrakeStatus(val angle: Int, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus {
|
||||
|
||||
override fun isException(): Boolean {
|
||||
return isError && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
|
||||
@@ -19,7 +19,7 @@ internal class AcceleratorImpl(ctx: Context): IFlow<AcceleratorStatus>(ctx), IMo
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var last: Float? = null
|
||||
private var last: Int? = null
|
||||
|
||||
@Volatile
|
||||
private var isError: Boolean = false
|
||||
@@ -40,9 +40,10 @@ internal class AcceleratorImpl(ctx: Context): IFlow<AcceleratorStatus>(ctx), IMo
|
||||
|
||||
override fun onAutopilotThrottle(throttle: Float) {
|
||||
super.onAutopilotThrottle(throttle)
|
||||
if (last != throttle) {
|
||||
send(AcceleratorStatus(throttle, isError).also { it.rawData = extra })
|
||||
last = throttle
|
||||
val current = throttle.toInt()
|
||||
if (last != current) {
|
||||
send(AcceleratorStatus(current, isError).also { it.rawData = extra })
|
||||
last = current
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,17 +51,17 @@ internal class AcceleratorImpl(ctx: Context): IFlow<AcceleratorStatus>(ctx), IMo
|
||||
if (!isAutopilotAbility) {
|
||||
val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_THROTTLE }?.also { itx ->
|
||||
isError = true
|
||||
send(AcceleratorStatus(last ?: 0.0f, true).also { extra = itx; it.rawData = itx })
|
||||
send(AcceleratorStatus(last ?: 0, true).also { extra = itx; it.rawData = itx })
|
||||
}
|
||||
if (target == null) {
|
||||
isError = false
|
||||
extra = null
|
||||
send(AcceleratorStatus(last ?: 0.0f, false))
|
||||
send(AcceleratorStatus(last ?: 0, false))
|
||||
}
|
||||
} else {
|
||||
isError = false
|
||||
extra = null
|
||||
send(AcceleratorStatus(last ?: 0.0f, false))
|
||||
send(AcceleratorStatus(last ?: 0, false))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,11 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisBrakeStateListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_BRAKE
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_THROTTLE
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.BrakeStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.AcceleratorImpl.Companion
|
||||
|
||||
internal class BrakeImpl(ctx: Context): IFlow<BrakeStatus>(ctx), IMoGoChassisBrakeStateListener, IMoGoAutopilotActionsListener {
|
||||
|
||||
@@ -22,7 +18,7 @@ internal class BrakeImpl(ctx: Context): IFlow<BrakeStatus>(ctx), IMoGoChassisBra
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var last: Float = 0.0f
|
||||
private var last: Int = 0
|
||||
|
||||
@Volatile
|
||||
private var isError: Boolean = false
|
||||
@@ -43,9 +39,10 @@ internal class BrakeImpl(ctx: Context): IFlow<BrakeStatus>(ctx), IMoGoChassisBra
|
||||
|
||||
override fun onAutopilotBrake(brake: Float) {
|
||||
super.onAutopilotBrake(brake)
|
||||
if (last != brake) {
|
||||
send(BrakeStatus(brake, isError).also { it.rawData = extra })
|
||||
last = brake
|
||||
val current = brake.toInt()
|
||||
if (last != current) {
|
||||
send(BrakeStatus(current, isError).also { it.rawData = extra })
|
||||
last = current
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,11 @@ package com.zhjt.mogo_core_function_devatools.status.flow.autopilot
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_THROTTLE
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.SpeedStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
|
||||
import kotlin.math.abs
|
||||
|
||||
internal class SpeedImpl(ctx: Context): IFlow<SpeedStatus>(ctx), IMoGoChassisLocationGCJ02Listener {
|
||||
|
||||
@@ -26,9 +18,6 @@ internal class SpeedImpl(ctx: Context): IFlow<SpeedStatus>(ctx), IMoGoChassisLoc
|
||||
@Volatile
|
||||
private var lastSpeed: Int? = null
|
||||
|
||||
@Volatile
|
||||
private var lastAcc: Float? = null
|
||||
|
||||
override fun onCreate() {
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 5, this)
|
||||
}
|
||||
@@ -40,20 +29,13 @@ internal class SpeedImpl(ctx: Context): IFlow<SpeedStatus>(ctx), IMoGoChassisLoc
|
||||
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
var isChanged = false
|
||||
val speed = mogoLocation?.gnssSpeed?.toInt() ?: 0
|
||||
val speed = (abs(mogoLocation?.gnssSpeed ?: 0f) * 3.6f).toInt()
|
||||
if (lastSpeed != speed) {
|
||||
isChanged = true
|
||||
lastSpeed = speed
|
||||
}
|
||||
val acceleration = mogoLocation?.acceleration?.toString()?.format("%.1")?.toFloat() ?: 0f
|
||||
if (!isChanged) {
|
||||
if (lastAcc != acceleration) {
|
||||
isChanged = true
|
||||
lastAcc = acceleration
|
||||
}
|
||||
}
|
||||
if (isChanged) {
|
||||
send(SpeedStatus(speed, acceleration))
|
||||
send(SpeedStatus(speed))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,13 +20,13 @@ internal class StatusModel : ViewModel() {
|
||||
it += RTKStatus("", -1)
|
||||
// it += NetStatus(false)
|
||||
// it += GpsStatus(enabled = false, isGranted = false)
|
||||
it += SteerStatus(0.0f)
|
||||
it += AcceleratorStatus(0.0f)
|
||||
it += BrakeStatus(0.0f)
|
||||
it += SteerStatus(0f)
|
||||
it += AcceleratorStatus(0)
|
||||
it += BrakeStatus(0)
|
||||
it += DoubleFlashStatus(0)
|
||||
it += GearStatus(0)
|
||||
it += RouteDownloadStatus()
|
||||
it += SpeedStatus(0, 0f)
|
||||
it += SpeedStatus(0)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhjt.mogo_core_function_devatools.status.ui
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
@@ -33,10 +34,9 @@ import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.iv_bra
|
||||
import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.iv_double_flash
|
||||
import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.iv_steer
|
||||
import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.speed
|
||||
import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.tv_accelerator
|
||||
import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.tv_brake_or_accelerator
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import kotlin.math.abs
|
||||
import kotlin.text.*
|
||||
|
||||
class AutoPilotLaunchBeforeView: LinearLayout, IStatusListener {
|
||||
|
||||
@@ -64,6 +64,7 @@ class AutoPilotLaunchBeforeView: LinearLayout, IStatusListener {
|
||||
StatusManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onStatusChanged(data: List<Status>, hasException: Boolean) {
|
||||
data.filter { it is IAutopilotPreLaunchStatus }.forEach { status ->
|
||||
val isError = status.isException() && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
@@ -90,9 +91,11 @@ class AutoPilotLaunchBeforeView: LinearLayout, IStatusListener {
|
||||
}
|
||||
is AcceleratorStatus -> {
|
||||
iv_brake_or_accelerator?.isSelected = isError
|
||||
tv_brake_or_accelerator?.text = "${abs(status.angle)}%"
|
||||
}
|
||||
is BrakeStatus -> {
|
||||
iv_brake_or_accelerator?.isSelected = isError
|
||||
tv_brake_or_accelerator?.text = "${-abs(status.angle)}%"
|
||||
}
|
||||
is DoubleFlashStatus -> {
|
||||
iv_double_flash?.isSelected = isError
|
||||
@@ -101,8 +104,7 @@ class AutoPilotLaunchBeforeView: LinearLayout, IStatusListener {
|
||||
iv_steer?.isSelected = isError
|
||||
}
|
||||
is SpeedStatus -> {
|
||||
speed?.text = "${(abs(status.speed) * 3.6f).toInt()}"
|
||||
tv_accelerator?.text = "a:" + String.format("%-3.1f", status.acc)
|
||||
speed?.text = "${status.speed}"
|
||||
}
|
||||
else -> {
|
||||
Logger.d(TAG, "other state: $status")
|
||||
|
||||
@@ -133,15 +133,16 @@
|
||||
android:layout_marginEnd="@dimen/dp_14"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_accelerator"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/tv_brake_or_accelerator"
|
||||
android:layout_width="@dimen/dp_85"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_30"
|
||||
android:gravity="end"
|
||||
android:layout_marginTop="-1dp"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
tools:text="a:-100"
|
||||
android:text="a: 0.0"/>
|
||||
tools:text="-100%"
|
||||
android:text="0%"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</merge>
|
||||
Reference in New Issue
Block a user