Merge branch 'dev_arch_opt_3.0' into dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0

This commit is contained in:
yangyakun
2023-02-15 10:18:54 +08:00
22 changed files with 143 additions and 148 deletions

View File

@@ -58,7 +58,6 @@ dependencies {
implementation rootProject.ext.dependencies.amapnavi3dmap
implementation project(':libraries:mogo-obu')
implementation project(':libraries:mogo-adas')
implementation project(':libraries:mogo-adas-data')
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_utils

View File

@@ -354,8 +354,6 @@ class MogoPrivateObuNewManager private constructor() {
when (status) {
MogoObuConstants.STATUS.ADD -> { // 添加
//显示警告红边
// CallerHmiManager.showWarning(direction)
//不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
@@ -583,7 +581,7 @@ class MogoPrivateObuNewManager private constructor() {
var ttsContent: String = ""
var changeVisualAngle = false
when (appId) {
//交叉路口碰撞预警
//前向碰撞预警
MogoObuConstants.V2X_WARNING_TYPE.FCW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType)
@@ -736,6 +734,7 @@ class MogoPrivateObuNewManager private constructor() {
}, direction
)
}
// ObuManager.getInstance().obuRvToTrackedObject(info)
//更新周边车辆进行预警颜色变换,车辆实时移动和变色 UUID不需要匹配了
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
CallerMapUIServiceManager.getMarkerService()

View File

@@ -115,7 +115,7 @@ class BindingCarManager : IMoGoAutopilotCarConfigListener {
SharedPrefsMgr.getInstance(mContext!!)
.putLong("typeDriver", System.currentTimeMillis() / (1000 * 60))
BindingCarNetWorkManager.instance
.getBindingcarInfo(mContext, macAddress, widevineIDWithMd5, screenType)
.getBindingCarInfo(mContext!!, macAddress, widevineIDWithMd5, screenType)
}
}
}
@@ -131,7 +131,7 @@ class BindingCarManager : IMoGoAutopilotCarConfigListener {
SharedPrefsMgr.getInstance(mContext!!)
.putLong("typePassenger", System.currentTimeMillis() / (1000 * 60))
BindingCarNetWorkManager.instance
.getBindingcarInfo(mContext, macAddress, widevineIDWithMd5, screenType)
.getBindingCarInfo(mContext!!, macAddress, widevineIDWithMd5, screenType)
}
}
}//乘客屏//司机屏

View File

@@ -3,6 +3,7 @@ package com.zhjt.mogo_core_function_devatools.binding
import android.content.Context
import com.mogo.commons.constants.HostConst
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.bindingcar.BindingCarInfo
import com.mogo.eagle.core.data.bindingcar.BindingCarRequest
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo
@@ -40,16 +41,17 @@ class BindingCarNetWorkManager private constructor() {
}
}
private val mBindingCarApiService: BindingCarApiService = MoGoRetrofitFactory.getInstance(HostConst.getHost())
.create(BindingCarApiService::class.java)
private val mBindingCarApiService: BindingCarApiService =
MoGoRetrofitFactory.getInstance(HostConst.getHost())
.create(BindingCarApiService::class.java)
/**
* 获取绑定的车辆信息
*
* @param macAddress mac地址
*/
fun getBindingcarInfo(
context: Context?,
fun getBindingCarInfo(
context: Context,
macAddress: String?,
widevineIDWithMd5: String?,
screenType: Int
@@ -72,10 +74,10 @@ class BindingCarNetWorkManager private constructor() {
override fun onSubscribe(d: Disposable) {}
override fun onNext(info: BindingCarInfo) {
if (info != null && info.getData() != null) {
d(
SceneConstant.M_BINDING + TAG,
"getBindingcarInfo onNext info.getData() =" + info.getData().toString()
)
d(SceneConstant.M_BINDING + TAG, "getBindingcarInfo data =" + info.getData().toString())
if (!SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.MAC_ADDRESS).equals(macAddress) && DebugConfig.isCarModelChange()) {
updateCarVrIconRes(info.getData().brandId);
}
//根据车辆类型切换不同的车辆模型,只针对红旗做处理
updateCarVrIconRes(info.getData().brandId)
when (info.getData().compare) {
@@ -83,10 +85,8 @@ class BindingCarNetWorkManager private constructor() {
"3" -> showModifyBindingCarDialog()
"null" -> TipToast.shortTip("当前工控机没有入库")
}
SharedPrefsMgr.getInstance(context!!).putString(
SharedPrefsConstants.CAR_INFO,
GsonUtils.toJson(info.getData())
)
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.CAR_INFO, GsonUtils.toJson(info.getData()))
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.MAC_ADDRESS, macAddress)
}
}

View File

@@ -35,10 +35,6 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo
init {
LayoutInflater.from(context).inflate(R.layout.view_steering_brake, this, true)
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.SteeringBrakeView)
val dayLight = typedArray.getBoolean(R.styleable.SteeringBrakeView_day_light_mode, false)
turnLightView.dayLightMode(dayLight)
typedArray.recycle()
}
override fun onAttachedToWindow() {
@@ -47,7 +43,6 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
if (gnssInfo != null) {
//设置刹车信息,小于默认认为是刹车
@@ -86,8 +81,6 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo
brakeView.visibility = View.GONE
isShowTurnLight = false
}
turnLightView.visibility = View.VISIBLE
turnLightView.setTurnLight(lightSwitch)
}
}

View File

@@ -11,9 +11,12 @@ import android.view.animation.Animation
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import chassis.Chassis
import com.mogo.eagle.core.function.api.map.angle.*
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
import com.mogo.eagle.core.function.api.map.angle.Turning
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_steering_brake.view.*
import kotlinx.android.synthetic.main.view_turn_light_status.view.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
@@ -25,33 +28,62 @@ import kotlinx.coroutines.launch
* @author lixiaopeng
* @since 2022/1/10
*/
class TurnLightViewStatus @JvmOverloads constructor(
open class TurnLightViewStatus @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoChassisLamplightListener {
private var init: Boolean = false
companion object {
private const val TAG = "TurnLightViewStatus"
}
fun dayLightMode(dayLight: Boolean) {
private val visible: Boolean
init {
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.TurnLightView)
val dayLight = typedArray.getBoolean(R.styleable.TurnLightView_day_light_mode, false)
if (dayLight) {
LayoutInflater.from(context)
.inflate(R.layout.view_turn_light_status_daytime, this, true)
} else {
LayoutInflater.from(context).inflate(R.layout.view_turn_light_status, this, true)
}
invalidate()
init = true
visible = typedArray.getBoolean(R.styleable.TurnLightView_visible, false)
if (visible) {
turn_light_layout.visibility = View.VISIBLE
} else {
turn_light_layout.visibility = View.GONE
}
typedArray.recycle()
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerChassisLamplightListenerManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerChassisLamplightListenerManager.removeListener(TAG)
}
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
super.onAutopilotLightSwitchData(lightSwitch)
lightSwitch?.let {
turnLightView.visibility = View.VISIBLE
setTurnLight(it)
}
}
/**
* 转向灯动画
*/
fun setTurnLight(directionLight: Chassis.LightSwitch) {
private fun setTurnLight(directionLight: Chassis.LightSwitch) {
if (!isAttachedToWindow) {
return
}
GlobalScope.launch(Dispatchers.Main) {
if (!init) {
return@launch
}
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
when (directionLight) {
Chassis.LightSwitch.LIGHT_LEFT -> { //左转向
@@ -135,7 +167,9 @@ class TurnLightViewStatus @JvmOverloads constructor(
}
override fun onAnimationEnd(p0: Animation?) {
turn_light_layout.visibility = View.GONE
if (visible) {
turn_light_layout.visibility = View.GONE
}
stopAnimate()
}
})

View File

@@ -5,23 +5,22 @@ import android.graphics.Color
import android.util.AttributeSet
import android.view.Gravity
import android.widget.FrameLayout
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import java.util.*
/**
* @author xiaoyuzhou
* @date 2021/8/25 8:25 下午
*/
class SpeedPanelView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener {
) : FrameLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener,
ILimitingVelocityListener {
companion object {
const val TAG = "SpeedPanelView"
@@ -30,11 +29,6 @@ class SpeedPanelView @JvmOverloads constructor(
var mContext: Context
var mSpeedChartView: SpeedChartView
var mLatLng: MogoLocation? = null
var mSpeedLimit = 60
private val timer by lazy {
Timer()
}
init {
setBackgroundResource(R.drawable.yi_biao_pan_bg_nor)
@@ -50,49 +44,34 @@ class SpeedPanelView @JvmOverloads constructor(
addView(mSpeedChartView)
}
private var timerTask: TimerTask? = null
override fun onAttachedToWindow() {
super.onAttachedToWindow()
// 注册位置回调
CallerLimitingVelocityListenerManager.addListener(TAG, this)
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
// 开启定时查询速度
timerTask?.cancel()
val task = object : TimerTask() {
override fun run() {
mLatLng?.let {
mSpeedLimit = CallerMapUIServiceManager.getMapUIController()!!.getLimitSpeed(it.longitude, it.latitude,
it.heading.toFloat()
)
UiThreadHandler.post {
val speed = (it.gnssSpeed * 3.6f).toInt()
mSpeedChartView.setArcColor(Color.parseColor(if (speed > mSpeedLimit) "#DB3137" else "#3E77F6"))
mSpeedChartView.setValues(speed)
setBackgroundResource(if (speed > mSpeedLimit) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
}
}
}
}
this.timerTask = task
timer.schedule(task, Date(), 200)
}
override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) {
gnssInfo?.let {
mLatLng = gnssInfo
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
mogoLocation?.let {
mLatLng = mogoLocation
}
}
override fun onLimitingVelocityChange(limitingVelocity: Int, sourceType: DataSourceType) {
super.onLimitingVelocityChange(limitingVelocity, sourceType)
mLatLng?.let {
UiThreadHandler.post {
val speed = (it.gnssSpeed * 3.6f).toInt()
mSpeedChartView.setArcColor(Color.parseColor(if (speed > limitingVelocity) "#DB3137" else "#3E77F6"))
mSpeedChartView.setValues(speed)
setBackgroundResource(if (speed > limitingVelocity) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
}
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
// 解除注册
CallerLimitingVelocityListenerManager.removeListener(TAG)
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
try {
timerTask?.cancel()
} catch (e: Exception) {
e.printStackTrace()
}
}
}

View File

@@ -69,9 +69,9 @@
<item name="android:borderlessButtonStyle">@android:color/transparent</item>
</style>
<declare-styleable name="SteeringBrakeView">
<declare-styleable name="TurnLightView">
<attr name="day_light_mode" format="boolean"/>
<attr name="brakeView" format="boolean"/>
<attr name="visible" format="boolean"/>
</declare-styleable>
<declare-styleable name="PncActionsView">

View File

@@ -67,6 +67,11 @@ object TrackerSourceColorHelper {
color = "#9900ffFF"
}
//僵尸车
if(data.addAttribute == AdditionalAttribute.ATTR_ZOMBIE){
color = "#D1E5FDFF"
}
// pnc预警
WarningHelper.getPncColor(data.uuid.toString()) {
if (it.isNotBlank()) {